Commit 4d4428c4b201395a8b3b459ba07892a2b31d7ba8
- Diff rendering mode:
- inline
- side by side
configure.ac
(1 / 0)
|   | |||
| 281 | 281 | plugins/gnome/icons/Makefile | |
| 282 | 282 | plugins/gnome/icons/16x16/Makefile | |
| 283 | 283 | plugins/gnome/icons/22x22/Makefile | |
| 284 | plugins/gsettings-ui/Makefile | ||
| 284 | 285 | plugins/python/Makefile | |
| 285 | 286 | po/Makefile.in | |
| 286 | 287 | doc/Makefile |
plugins/Makefile.am
(4 / 0)
|   | |||
| 10 | 10 | SUBDIRS += python | |
| 11 | 11 | endif | |
| 12 | 12 | ||
| 13 | if BUILD_GSETTINGS_UI | ||
| 14 | SUBDIRS += gsettings-ui | ||
| 15 | endif | ||
| 16 | |||
| 13 | 17 | dtddir = $(pkgdatadir)/catalogs | |
| 14 | 18 | dtd_DATA = glade-catalog.dtd | |
| 15 | 19 |
plugins/gsettings-ui/Makefile.am
(41 / 0)
|   | |||
| 1 | ## Process this file with automake to produce Makefile.in | ||
| 2 | |||
| 3 | SUBDIRS = | ||
| 4 | |||
| 5 | libgladeui = $(top_builddir)/gladeui/libgladeui-1.la | ||
| 6 | |||
| 7 | |||
| 8 | # libgladegsettings | ||
| 9 | |||
| 10 | gladegsettings_LTLIBRARIES = libgladegsettings.la | ||
| 11 | gladegsettingsdir = $(pkglibdir)/modules | ||
| 12 | |||
| 13 | libgladegsettings_la_SOURCES = glade-gsettings.c | ||
| 14 | libgladegsettings_la_CPPFLAGS = $(AM_CPPFLAGS) | ||
| 15 | libgladegsettings_la_CFLAGS = \ | ||
| 16 | -DG_LOG_DOMAIN=\"GladeUI-GSettings\" \ | ||
| 17 | -I$(top_srcdir) \ | ||
| 18 | -I$(top_builddir) \ | ||
| 19 | -I$(top_srcdir)/plugins/gtk+ \ | ||
| 20 | $(PLUGINS_WARN_CFLAGS) \ | ||
| 21 | $(GTK_CFLAGS) \ | ||
| 22 | $(AM_CPPFLAGS) | ||
| 23 | libgladegsettings_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS) | ||
| 24 | libgladegsettings_la_LIBADD = $(libgladeui) $(GTK_LIBS) $(GLADE_LIBS) | ||
| 25 | |||
| 26 | if PLATFORM_WIN32 | ||
| 27 | libgladegsettings_la_LDFLAGS += -no-undefined | ||
| 28 | endif | ||
| 29 | |||
| 30 | |||
| 31 | # catalog data | ||
| 32 | |||
| 33 | catalogsdir = $(pkgdatadir)/catalogs | ||
| 34 | catalogs_DATA = gsettings-ui.xml \ | ||
| 35 | gsettings-ui.xml.in | ||
| 36 | @INTLTOOL_XML_NOMERGE_RULE@ | ||
| 37 | |||
| 38 | |||
| 39 | CLEANFILES = gsettings-ui.xml | ||
| 40 | |||
| 41 | EXTRA_DIST = $(catalogs_DATA) |
|   | |||
| 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2009 Sam Thursfield | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as | ||
| 7 | * published by the Free Software Foundation; either version 2.1 of the | ||
| 8 | * License, or (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 18 | * | ||
| 19 | * Authors: | ||
| 20 | * Sam Thursfield <ssssam@gmail.com> | ||
| 21 | */ | ||
| 22 | |||
| 23 | #include <config.h> | ||
| 24 | |||
| 25 | #include <glib/gi18n-lib.h> | ||
| 26 | |||
| 27 | #include "glade-gsettings.h" | ||
| 28 | #include "glade-gtk.h" | ||
| 29 | #include "glade-column-types.h" | ||
| 30 | #include "glade-model-data.h" | ||
| 31 | |||
| 32 | #include <string.h> | ||
| 33 | |||
| 34 | /*--------------------------- GtkSettingsList ---------------------------------*/ | ||
| 35 | |||
| 36 | /* A real GtkSettingsList is a GSettingsList that implements GtkBuildable. This stores its data in | ||
| 37 | * GSettings, which requires a schema. Since the schema will be generated from our output, and | ||
| 38 | * the user doesn't need the data he inputs in GLADE stored in persistant settings storage medium, | ||
| 39 | * we take a totally different approach. Our GtkSettingsList is basically a GtkListStore with a | ||
| 40 | * fixed number of columns. | ||
| 41 | * | ||
| 42 | * The data is set as the default in the schema by gsettings-scan-ui, and a real GtkSettingsList is | ||
| 43 | * created in the application when it loads the .ui file. | ||
| 44 | */ | ||
| 45 | |||
| 46 | /* FIXME: one problem with this setup is now GLADE can't link against gsettings-ui if it ever | ||
| 47 | * wants to. I can't see a way to give 'fake' widgets like this a different name, so I guess it will | ||
| 48 | * need to be implemented if GLADE ever starts using GSettings UI. (Although normal GSettings will | ||
| 49 | * be fine.) | ||
| 50 | */ | ||
| 51 | |||
| 52 | #define GTK_TYPE_SETTINGS_LIST (gtk_settings_list_get_type()) | ||
| 53 | #define GTK_SETTINGS_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SETTINGS_LIST, GtkSettingsList)) | ||
| 54 | |||
| 55 | typedef struct | ||
| 56 | { | ||
| 57 | GtkListStore parent; | ||
| 58 | } GtkSettingsList; | ||
| 59 | |||
| 60 | typedef struct | ||
| 61 | { | ||
| 62 | GtkListStoreClass parent_class; | ||
| 63 | } GtkSettingsListClass; | ||
| 64 | |||
| 65 | enum { | ||
| 66 | GTK_SETTINGS_LIST_PROP_0, | ||
| 67 | GTK_SETTINGS_LIST_PROP_COLUMNS | ||
| 68 | }; | ||
| 69 | |||
| 70 | G_DEFINE_TYPE (GtkSettingsList, gtk_settings_list, GTK_TYPE_LIST_STORE) | ||
| 71 | |||
| 72 | static void | ||
| 73 | gtk_settings_list_init (GtkSettingsList *self) | ||
| 74 | { | ||
| 75 | static const GType column_types[1] = { G_TYPE_STRING }; | ||
| 76 | gtk_list_store_set_column_types (GTK_LIST_STORE (self), 1, column_types); | ||
| 77 | } | ||
| 78 | |||
| 79 | static void | ||
| 80 | gtk_settings_list_class_init (GtkSettingsListClass *klass) | ||
| 81 | { | ||
| 82 | } | ||
| 83 | |||
| 84 | |||
| 85 | void | ||
| 86 | glade_gtk_settings_list_post_create (GladeWidgetAdaptor *adaptor, | ||
| 87 | GObject *container, | ||
| 88 | GladeCreateReason reason) | ||
| 89 | { | ||
| 90 | GladeWidget *glade_widget = glade_widget_get_from_gobject (container); | ||
| 91 | } | ||
| 92 | void | ||
| 93 | glade_gtk_settings_list_set_property (GladeWidgetAdaptor *adaptor, | ||
| 94 | GObject *object, | ||
| 95 | const gchar *property_name, | ||
| 96 | const GValue *value) | ||
| 97 | { | ||
| 98 | if (strcmp (property_name, "columns") == 0) | ||
| 99 | { | ||
| 100 | /* glade_gtk_store_set_columns (object, value); */ | ||
| 101 | } | ||
| 102 | else if (strcmp (property_name, "data") == 0) | ||
| 103 | { | ||
| 104 | glade_gtk_store_set_data (object, value); | ||
| 105 | } | ||
| 106 | else | ||
| 107 | /* Chain Up */ | ||
| 108 | GWA_GET_CLASS (G_TYPE_OBJECT)->set_property (adaptor, | ||
| 109 | object, | ||
| 110 | property_name, | ||
| 111 | value); | ||
| 112 | } | ||
| 113 | |||
| 114 | void | ||
| 115 | glade_gtk_settings_list_write_widget (GladeWidgetAdaptor *adaptor, | ||
| 116 | GladeWidget *widget, | ||
| 117 | GladeXmlContext *context, | ||
| 118 | GladeXmlNode *node) | ||
| 119 | { | ||
| 120 | if (!glade_xml_node_verify | ||
| 121 | (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project)))) | ||
| 122 | return; | ||
| 123 | |||
| 124 | /* First chain up and write all the normal properties.. */ | ||
| 125 | GWA_GET_CLASS (G_TYPE_OBJECT)->write_widget (adaptor, widget, context, node); | ||
| 126 | |||
| 127 | glade_gtk_store_write_data (widget, context, node); | ||
| 128 | } | ||
| 129 | |||
| 130 | void | ||
| 131 | glade_gtk_settings_list_read_widget (GladeWidgetAdaptor *adaptor, | ||
| 132 | GladeWidget *widget, | ||
| 133 | GladeXmlNode *node) | ||
| 134 | { | ||
| 135 | if (!glade_xml_node_verify | ||
| 136 | (node, GLADE_XML_TAG_WIDGET (glade_project_get_format (widget->project)))) | ||
| 137 | return; | ||
| 138 | |||
| 139 | GValue value = { 0 }; | ||
| 140 | GList *column_list = NULL; | ||
| 141 | GladeColumnType *column; | ||
| 142 | GladeProperty *property; | ||
| 143 | |||
| 144 | /* Set column info which is hardcoded. */ | ||
| 145 | |||
| 146 | /* Column 0: G_TYPE_STRING */ | ||
| 147 | column = g_new (GladeColumnType, 1); | ||
| 148 | column->type = G_TYPE_STRING; | ||
| 149 | column->column_name = g_strdup (_("Name")); | ||
| 150 | column_list = g_list_append (column_list, column); | ||
| 151 | |||
| 152 | /* Column 1: G_TYPE_SETTINGS */ | ||
| 153 | /* this one is not currently editable. */ | ||
| 154 | |||
| 155 | g_value_init (&value, GLADE_TYPE_COLUMN_TYPE_LIST); | ||
| 156 | g_value_take_boxed (&value, column_list); | ||
| 157 | property = glade_widget_get_property (widget, "columns"); | ||
| 158 | glade_property_set_value (property, &value); | ||
| 159 | g_value_unset (&value); | ||
| 160 | |||
| 161 | /* First chain up and read in all the normal properties.. */ | ||
| 162 | GWA_GET_CLASS (G_TYPE_OBJECT)->read_widget (adaptor, widget, node); | ||
| 163 | |||
| 164 | if (GTK_IS_LIST_STORE (widget->object)) | ||
| 165 | glade_gtk_store_read_data (widget, node); | ||
| 166 | } |
|   | |||
| 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2001 Ximian, Inc. | ||
| 4 | * Copyright (C) 2004 - 2008 Tristan Van Berkom, Juan Pablo Ugarte et al. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as | ||
| 8 | * published by the Free Software Foundation; either version 2 of the | ||
| 9 | * License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 19 | * | ||
| 20 | * Authors: | ||
| 21 | * Sam Thursfield <ssssam@gmail.com> | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
| 25 | #ifndef __GLADE_GSETTINGS_H__ | ||
| 26 | #define __GLADE_GSETTINGS_H__ | ||
| 27 | |||
| 28 | #include <gladeui/glade.h> | ||
| 29 | #include <gtk/gtk.h> | ||
| 30 | |||
| 31 | |||
| 32 | /* Types */ | ||
| 33 | |||
| 34 | GParamSpec *glade_gsettings_gnome_ui_info_spec (void); | ||
| 35 | |||
| 36 | |||
| 37 | #endif /* __GLADE_GTK_H__ */ |
|   | |||
| 1 | <glade-catalog name="gsettings-ui" | ||
| 2 | version="0.2" | ||
| 3 | supports="gtkbuilder" | ||
| 4 | icon-prefix="gsettings-ui" | ||
| 5 | library="gladegsettings" | ||
| 6 | domain="glade3" | ||
| 7 | depends="gtk+"> | ||
| 8 | <glade-widget-classes> | ||
| 9 | |||
| 10 | <glade-widget-class name="GtkSettingsList" generic-name="settingslist" _title="Settings List" | ||
| 11 | libglade-unsupported="True" toplevel="True"> | ||
| 12 | <post-create-function>glade_gtk_settings_list_post_create</post-create-function> | ||
| 13 | <set-property-function>glade_gtk_settings_list_set_property</set-property-function> | ||
| 14 | <create-editor-property-function>glade_gtk_store_create_eprop</create-editor-property-function> | ||
| 15 | <create-editable-function>glade_gtk_store_create_editable</create-editable-function> | ||
| 16 | <string-from-value-function>glade_gtk_store_string_from_value</string-from-value-function> | ||
| 17 | <write-widget-function>glade_gtk_settings_list_write_widget</write-widget-function> | ||
| 18 | <read-widget-function>glade_gtk_settings_list_read_widget</read-widget-function> | ||
| 19 | <properties> | ||
| 20 | |||
| 21 | <!-- Columns is a fake read-only property, because a GSettingsList has fixed columns. --> | ||
| 22 | <property id="columns" _name="Columns" save="False" custom-layout="True"> | ||
| 23 | <parameter-spec> | ||
| 24 | <type>GParamBoxed</type> | ||
| 25 | <value-type>GladeColumnTypeList</value-type> | ||
| 26 | </parameter-spec> | ||
| 27 | <_tooltip>Column names and types - read-only</_tooltip> | ||
| 28 | </property> | ||
| 29 | |||
| 30 | <property id="data" _name="Data" save="False" custom-layout="True"> | ||
| 31 | <parameter-spec> | ||
| 32 | <type>GParamBoxed</type> | ||
| 33 | <value-type>GladeModelDataTree</value-type> | ||
| 34 | </parameter-spec> | ||
| 35 | <_tooltip>Enter a list of values to be applied on each row</_tooltip> | ||
| 36 | </property> | ||
| 37 | </properties> | ||
| 38 | </glade-widget-class> | ||
| 39 | |||
| 40 | </glade-widget-classes> | ||
| 41 | |||
| 42 | <!-- FIXME: I would rather these went in with the Gtk+ widgets, but this requires either: | ||
| 43 | - implementing widget group merging (and might mislead users into thinking they don't need | ||
| 44 | to depend on libgsettings-ui) | ||
| 45 | - merging with the Gtk+ plugin, which only makes sense if the gsettings-ui widgets are merged | ||
| 46 | into Gtk+. In turn, this would only happen if it gets decided that Gtk+ will depend hard on | ||
| 47 | Gsettings. | ||
| 48 | --> | ||
| 49 | <glade-widget-group name="gsettings" _title="GSettings"> | ||
| 50 | <glade-widget-class-ref name="GtkSettingsList"/> | ||
| 51 | </glade-widget-group> | ||
| 52 | |||
| 53 | </glade-catalog> |
plugins/gtk+/glade-gtk.c
(3 / 3)
|   | |||
| 9839 | 9839 | gtk_tree_store_set_column_types (GTK_TREE_STORE (object), n, types); | |
| 9840 | 9840 | } | |
| 9841 | 9841 | ||
| 9842 | static void | ||
| 9842 | void | ||
| 9843 | 9843 | glade_gtk_store_set_data (GObject *object, | |
| 9844 | 9844 | const GValue *value) | |
| 9845 | 9845 | { | |
| … | … | ||
| 10069 | 10069 | ||
| 10070 | 10070 | } | |
| 10071 | 10071 | ||
| 10072 | static void | ||
| 10072 | void | ||
| 10073 | 10073 | glade_gtk_store_write_data (GladeWidget *widget, | |
| 10074 | 10074 | GladeXmlContext *context, | |
| 10075 | 10075 | GladeXmlNode *node) | |
| … | … | ||
| 10224 | 10224 | g_value_unset (&value); | |
| 10225 | 10225 | } | |
| 10226 | 10226 | ||
| 10227 | static void | ||
| 10227 | void | ||
| 10228 | 10228 | glade_gtk_store_read_data (GladeWidget *widget, GladeXmlNode *node) | |
| 10229 | 10229 | { | |
| 10230 | 10230 | GladeXmlNode *data_node, *row_node, *col_node; |
plugins/gtk+/glade-gtk.h
(8 / 1)
|   | |||
| 10 | 10 | ||
| 11 | 11 | GParamSpec *glade_gtk_gnome_ui_info_spec (void); | |
| 12 | 12 | ||
| 13 | |||
| 13 | /* Utilities for other plugins */ | ||
| 14 | |||
| 15 | void glade_gtk_store_write_data (GladeWidget *widget, GladeXmlContext *context, | ||
| 16 | GladeXmlNode *node); | ||
| 17 | void glade_gtk_store_read_data (GladeWidget *widget, GladeXmlNode *node); | ||
| 18 | void glade_gtk_store_set_data (GObject *object, const GValue *value); | ||
| 19 | |||
| 20 | |||
| 14 | 21 | #endif /* __GLADE_GTK_H__ */ |
|   | |||
| 112 | 112 | g_object_weak_ref (G_OBJECT (store_editor->loaded_widget->project), | |
| 113 | 113 | (GWeakNotify)project_finalized, | |
| 114 | 114 | store_editor); | |
| 115 | |||
| 116 | /* Decide whether to show the column editor. */ | ||
| 117 | if (strcmp (g_type_name (widget->adaptor->type), "GtkSettingsList") == 0) | ||
| 118 | store_editor->columns_editable = FALSE; | ||
| 119 | else | ||
| 120 | store_editor->columns_editable = TRUE; | ||
| 121 | |||
| 122 | if (store_editor->columns_editable) | ||
| 123 | gtk_widget_show (store_editor->column_editor_frame); | ||
| 124 | else | ||
| 125 | gtk_widget_hide (store_editor->column_editor_frame); | ||
| 115 | 126 | } | |
| 116 | 127 | ||
| 117 | 128 | /* load the embedded editable... */ | |
| … | … | ||
| 192 | 192 | /* Label item in frame label widget on top.. */ | |
| 193 | 193 | eprop = glade_widget_adaptor_create_eprop_by_name (adaptor, "columns", FALSE, TRUE); | |
| 194 | 194 | store_editor->properties = g_list_prepend (store_editor->properties, eprop); | |
| 195 | frame = gtk_frame_new (NULL); | ||
| 195 | store_editor->column_editor_frame = frame = gtk_frame_new (NULL); | ||
| 196 | 196 | gtk_frame_set_label_widget (GTK_FRAME (frame), eprop->item_label); | |
| 197 | 197 | gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); | |
| 198 | 198 | gtk_box_pack_start (GTK_BOX (store_editor), frame, FALSE, FALSE, 12); |
|   | |||
| 42 | 42 | ||
| 43 | 43 | GladeWidget *loaded_widget; /* A handy pointer to the loaded widget ... */ | |
| 44 | 44 | ||
| 45 | GtkWidget *embed; | ||
| 45 | GtkWidget *embed, *column_editor_frame; | ||
| 46 | 46 | ||
| 47 | 47 | GList *properties; /* A list of eprops to update at load() time */ | |
| 48 | |||
| 49 | gboolean columns_editable; /* If false, the column editor is hidden. */ | ||
| 48 | 50 | }; | |
| 49 | 51 | ||
| 50 | 52 | struct _GladeStoreEditorClass |

