anjuta r4929 - in trunk: . libanjuta plugins/sourceview po scripts
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4929 - in trunk: . libanjuta plugins/sourceview po scripts
- Date: Tue, 7 Apr 2009 10:19:20 +0000 (UTC)
Author: jhs
Date: Tue Apr 7 10:19:20 2009
New Revision: 4929
URL: http://svn.gnome.org/viewvc/anjuta?rev=4929&view=rev
Log:
2009-04-07 Johannes Schmid <jhs gnome org>
* libanjuta/anjuta-preferences.c
(anjuta_preferences_register_all_properties_from_builder_xml),
(anjuta_preferences_add_from_builder):
* libanjuta/anjuta-preferences.h:
Added methods to add pages from gtkbuilder instead of glade
* plugins/sourceview/Makefile.am:
* plugins/sourceview/anjuta-editor-sourceview.glade:
* plugins/sourceview/anjuta-editor-sourceview.ui:
* plugins/sourceview/plugin.c (on_font_check_toggled),
(ipreferences_merge), (ipreferences_unmerge):
* plugins/sourceview/sourceview.c (sourceview_new):
Replace libglade with gtkbuilder
* scripts/build-schemas.mk:
* scripts/builder2schema.pl:
* scripts/Makefile.am
Add a new script to generate schemas from gtkbuilder instead of glade
files and adjusted Makefile.
Added:
trunk/plugins/sourceview/anjuta-editor-sourceview.ui
trunk/scripts/builder2schema.pl (contents, props changed)
Removed:
trunk/plugins/sourceview/anjuta-editor-sourceview.glade
Modified:
trunk/ChangeLog
trunk/libanjuta/anjuta-preferences.c
trunk/libanjuta/anjuta-preferences.h
trunk/plugins/sourceview/Makefile.am
trunk/plugins/sourceview/plugin.c
trunk/plugins/sourceview/sourceview.c
trunk/po/ChangeLog
trunk/po/POTFILES.in
trunk/scripts/Makefile.am
trunk/scripts/build-schemas.mk
Modified: trunk/libanjuta/anjuta-preferences.c
==============================================================================
--- trunk/libanjuta/anjuta-preferences.c (original)
+++ trunk/libanjuta/anjuta-preferences.c Tue Apr 7 10:19:20 2009
@@ -1513,6 +1513,64 @@
}
/**
+ * anjuta_preferences_register_all_properties_from_builder_xml:
+ * @pr: a #AnjutaPreferences Object
+ * @builder: GtkBuilder object containing the properties widgets.
+ * @parent: Parent widget in the builder object
+ *
+ * This will register all the properties names of the format described above
+ * without considering the UI. Useful if you have the widgets shown elsewhere
+ * but you want them to be part of preferences system.
+ */
+void
+anjuta_preferences_register_all_properties_from_builder_xml (AnjutaPreferences *pr,
+ GtkBuilder *builder,
+ GtkWidget *parent)
+{
+ GSList *widgets;
+ GSList *node;
+
+ g_return_if_fail (ANJUTA_IS_PREFERENCES (pr));
+ g_return_if_fail (builder != NULL);
+
+ widgets = gtk_builder_get_objects (builder);
+ for (node = widgets; node != NULL; node = g_slist_next (node))
+ {
+ const gchar *name;
+ const gchar *property;
+ GtkWidget *widget, *p;
+ gboolean cont_flag = FALSE;
+
+ if (!GTK_IS_WIDGET (node->data))
+ continue;
+
+ widget = node->data;
+ name = gtk_widget_get_name (widget);
+
+ if (!g_str_has_prefix (name, PREFERENCE_PROPERTY_PREFIX))
+ continue;
+
+ p = gtk_widget_get_parent (widget);
+ /* Added only if it's a desendend child of the parent */
+ while (p != parent)
+ {
+ if (p == NULL)
+ {
+ cont_flag = TRUE;
+ break;
+ }
+ p = gtk_widget_get_parent (p);
+ }
+ if (cont_flag)
+ continue;
+
+ property = &name[strlen (PREFERENCE_PROPERTY_PREFIX)];
+ anjuta_preferences_register_property_from_string (pr, widget,
+ property);
+ }
+}
+
+/**
* anjuta_preferences_reset_defaults:
* @pr: a #AnjutaPreferences object.
*
@@ -1649,6 +1707,86 @@
g_object_unref (pixbuf);
}
+/**
+ * anjuta_preferences_add_page:
+ * @pr: a #AnjutaPreferences object
+ * @builder: #GtkBuilder object containing the preferences page
+ * @gwidget_name: Page widget name (as give with glade interface editor).
+ * The widget will be searched with the given name and detached
+ * (that is, removed from the container, if present) from it's parent.
+ * @icon_filename: File name (of the form filename.png) of the icon representing
+ * the preference page.
+ *
+ * Add a page to the preferences sytem.
+ * builder is the GtkBuilder object of the dialog containing the page widget.
+ * The dialog will contain the layout of the preferences widgets.
+ * The widgets which are preference widgets (e.g. toggle button) should have
+ * widget names of the form:
+ *
+ * <programlisting>
+ * preferences_OBJECTTYPE:DATATYPE:DEFAULT:FLAGS:PROPERTYKEY
+ * where,
+ * OBJECTTYPE is 'toggle', 'spin', 'entry', 'text', 'color', 'font' or 'file' .
+ * DATATYPE is 'bool', 'int', 'float', 'text', 'color' or 'font'.
+ * DEFAULT is the default value (in the appropriate format). The format
+ * for color is '#XXXXXX' representing RGB value and for
+ * font, it is the pango font description.
+ * FLAGS is any flag associated with the property. Currently it
+ * has only two values -- 0 and 1. For normal preference
+ * property which is saved/retrieved globally, the flag = 0.
+ * For preference property which is also saved/retrieved
+ * along with the project, the flag = 1.
+ * PROPERTYKEY is the property key. e.g - 'tab.size'.
+ * </programlisting>
+ *
+ * All widgets having the above names in the gxml tree will be registered
+ * and will become part of auto saving/loading. For example, refer to
+ * anjuta preferences dialogs and study the widget names.
+ */
+void
+anjuta_preferences_add_from_builder (AnjutaPreferences* pr,
+ GtkBuilder* builder,
+ const gchar* widget_name,
+ const gchar* title,
+ const gchar *icon_filename)
+{
+ GtkWidget *parent;
+ GtkWidget *page;
+ GdkPixbuf *pixbuf;
+ gchar *image_path;
+
+ g_return_if_fail (ANJUTA_IS_PREFERENCES (pr));
+ g_return_if_fail (widget_name != NULL);
+ g_return_if_fail (icon_filename != NULL);
+
+ page = GTK_WIDGET(gtk_builder_get_object (builder, widget_name));
+ g_object_ref (page);
+ g_return_if_fail (GTK_IS_WIDGET (page));
+ parent = gtk_widget_get_parent (page);
+ if (parent && GTK_IS_CONTAINER (parent))
+ {
+ if (GTK_IS_NOTEBOOK (parent))
+ {
+ gint page_num;
+
+ page_num = gtk_notebook_page_num (GTK_NOTEBOOK (parent), page);
+ gtk_notebook_remove_page (GTK_NOTEBOOK (parent), page_num);
+ }
+ else
+ {
+ gtk_container_remove (GTK_CONTAINER (parent), page);
+ }
+ }
+ image_path = anjuta_res_get_pixmap_file (icon_filename);
+ pixbuf = gdk_pixbuf_new_from_file (image_path, NULL);
+ anjuta_preferences_dialog_add_page (ANJUTA_PREFERENCES_DIALOG (pr->priv->prefs_dialog),
+ widget_name, title, pixbuf, page);
+ anjuta_preferences_register_all_properties_from_builder_xml (pr, builder, page);
+ g_object_unref (page);
+ g_free (image_path);
+ g_object_unref (pixbuf);
+}
+
void
anjuta_preferences_remove_page (AnjutaPreferences *pr,
const gchar *page_name)
Modified: trunk/libanjuta/anjuta-preferences.h
==============================================================================
--- trunk/libanjuta/anjuta-preferences.h (original)
+++ trunk/libanjuta/anjuta-preferences.h Tue Apr 7 10:19:20 2009
@@ -94,6 +94,11 @@
const gchar* glade_widget_name,
const gchar* title,
const gchar *icon_filename);
+void anjuta_preferences_add_from_builder (AnjutaPreferences* pr,GtkBuilder *builder,
+ const gchar* glade_widget_name,
+ const gchar* title,
+ const gchar *icon_filename);
+
void anjuta_preferences_remove_page (AnjutaPreferences *pr,
const gchar *page_name);
@@ -104,6 +109,13 @@
void anjuta_preferences_register_all_properties_from_glade_xml (AnjutaPreferences* pr,
GladeXML *gxml,
GtkWidget *parent);
+/*
+ * Registers all properties defined for widgets below the 'parent' widget
+ * in the given gtkbuilder UI tree
+ */
+void anjuta_preferences_register_all_properties_from_builder_xml (AnjutaPreferences* pr,
+ GtkBuilder* builder,
+ GtkWidget *parent);
gboolean
anjuta_preferences_register_property_from_string (AnjutaPreferences *pr,
GtkWidget *object,
Modified: trunk/plugins/sourceview/Makefile.am
==============================================================================
--- trunk/plugins/sourceview/Makefile.am (original)
+++ trunk/plugins/sourceview/Makefile.am Tue Apr 7 10:19:20 2009
@@ -1,8 +1,8 @@
if HAVE_PLUGIN_SOURCEVIEW
# Plugin glade file
-sourceview_gladedir = $(anjuta_glade_dir)
-sourceview_glade_DATA = anjuta-editor-sourceview.glade
+sourceview_xmldir = $(anjuta_glade_dir)
+sourceview_xml_DATA = anjuta-editor-sourceview.ui
# Plugin Icon file
sourceview_pixmapsdir = $(anjuta_image_dir)
@@ -80,7 +80,7 @@
$(GLADE_LIBS) \
$(LIBANJUTA_LIBS)
-prefs_glade_files = anjuta-editor-sourceview.glade
+prefs_ui_files = anjuta-editor-sourceview.ui
include $(top_srcdir)/scripts/build-schemas.mk
endif
@@ -90,6 +90,6 @@
$(plugin_in_files) \
$(sourceview_plugin_DATA) \
$(sourceview_pixmaps_DATA) \
- $(sourceview_glade_DATA)
+ $(sourceview_xml_DATA)
Added: trunk/plugins/sourceview/anjuta-editor-sourceview.ui
==============================================================================
--- (empty file)
+++ trunk/plugins/sourceview/anjuta-editor-sourceview.ui Tue Apr 7 10:19:20 2009
@@ -0,0 +1,666 @@
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="lower">1</property>
+ <property name="page_increment">10</property>
+ <property name="step_increment">1</property>
+ <property name="page_size">0</property>
+ <property name="value">4</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">200</property>
+ <property name="lower">0</property>
+ <property name="page_increment">10</property>
+ <property name="step_increment">1</property>
+ <property name="page_size">0</property>
+ <property name="value">80</property>
+ </object>
+ <!-- interface-requires gtk+ 2.16 -->
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkWindow" id="preferences_dialog">
+ <property name="title">window1</property>
+ <child>
+ <object class="GtkNotebook" id="Editor">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <child>
+ <object class="GtkFrame" id="page2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkVBox" id="vbox1111">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTable" id="table15">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">4</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:use.tabs">
+ <property name="label" translatable="yes">Use tabs for indentation</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="preferences_spin:int:4:1:tabsize">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="x_options"/>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label122">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Tab size in spaces:</property>
+ </object>
+ <packing>
+ <property name="right_attach">3</property>
+ <property name="y_options">GTK_EXPAND</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12321">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Indentation and auto-format options</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="page1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkVBox" id="vbox31">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkFrame" id="frame47">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkVBox" id="vbox1120">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.syntax.highlight">
+ <property name="label" translatable="yes">Highlight syntax</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:sourceview.brackets.highlight">
+ <property name="label" translatable="yes">Highlight matching brackets</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.backup">
+ <property name="label" translatable="yes">Create backup files</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12337">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Options</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox32">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:0:0:sourceview.currentline.highlight">
+ <property name="label" translatable="yes">Highlight current line</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin.linenumber.visible">
+ <property name="label" translatable="yes">Show line numbers</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:margin.marker.visible">
+ <property name="label" translatable="yes">Show marks</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.rightmargin.visible">
+ <property name="label" translatable="yes">Show right margin</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table4">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Right margin position in characters</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="preferences_spin:int:80:0:sourceview.rightmargin.position">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment2</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>View</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label12350">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Editor</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table18">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <child>
+ <object class="GtkFrame" id="frame49">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table20">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkFontButton" id="preferences_font:font:Monospace 12:0:sourceview.font">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:sourceview.font.use_theme">
+ <property name="label" translatable="yes">Use theme font</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Font:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="x_padding">5</property>
+ <property name="y_padding">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame48">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <child>
+ <object class="GtkComboBox" id="combo_styles">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12355">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Color scheme:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_padding">5</property>
+ <property name="y_padding">5</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label12360">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Font</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="page3">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkTable" id="table17">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="n_rows">6</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.header">
+ <property name="label" translatable="yes">Print page header</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.footer">
+ <property name="label" translatable="yes">Print page footer</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linenumbers">
+ <property name="label" translatable="yes">Print Linenumbers</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.highlight">
+ <property name="label" translatable="yes">Highlight syntax</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences_toggle:bool:1:0:print.linewrap">
+ <property name="label" translatable="yes">Wrap long lines to fit on paper</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label129">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes"><b>Print options</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label12352">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Printing</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
Modified: trunk/plugins/sourceview/plugin.c
==============================================================================
--- trunk/plugins/sourceview/plugin.c (original)
+++ trunk/plugins/sourceview/plugin.c Tue Apr 7 10:19:20 2009
@@ -38,7 +38,7 @@
#include "sourceview.h"
#include "sourceview-private.h"
-#define PREFS_GLADE PACKAGE_DATA_DIR"/glade/anjuta-editor-sourceview.glade"
+#define PREFS_GLADE PACKAGE_DATA_DIR"/glade/anjuta-editor-sourceview.ui"
#define ICON_FILE "anjuta-editor-sourceview-plugin-48.png"
#define COMBO_STYLES "combo_styles"
@@ -49,13 +49,13 @@
static gpointer parent_class;
-static GladeXML* gxml = NULL;
+static GtkBuilder* builder = NULL;
static void
-on_font_check_toggled(GtkToggleButton* button, GladeXML* gxml)
+on_font_check_toggled(GtkToggleButton* button, GtkBuilder* builder)
{
GtkWidget* font_button;
- font_button = glade_xml_get_widget(gxml, FONT_BUTTON);
+ font_button = GTK_WIDGET (gtk_builder_get_object (builder, FONT_BUTTON));
gtk_widget_set_sensitive(font_button, !gtk_toggle_button_get_active(button));
}
@@ -218,16 +218,28 @@
GtkCellRenderer* renderer_name = gtk_cell_renderer_text_new ();
GtkCellRenderer* renderer_desc = gtk_cell_renderer_text_new ();
GtkTreeIter* iter = NULL;
- gxml = glade_xml_new (PREFS_GLADE, "preferences_dialog", NULL);
- anjuta_preferences_add_page (prefs,
- gxml, "Editor", _("GtkSourceView Editor"), ICON_FILE);
-
- plugin->check_font = glade_xml_get_widget(gxml, FONT_USE_THEME_BUTTON);
- g_signal_connect(G_OBJECT(plugin->check_font), "toggled", G_CALLBACK(on_font_check_toggled), gxml);
- on_font_check_toggled (GTK_TOGGLE_BUTTON (plugin->check_font), gxml);
+ GError* error = NULL;
+ builder = gtk_builder_new ();
+ if (!gtk_builder_add_from_file(builder, PREFS_GLADE, &error))
+ {
+ DEBUG_PRINT ("Could load sourceview preferences: %s", error->msg);
+ g_error_free (error);
+ return;
+ }
+ anjuta_preferences_add_from_builder (prefs,
+ builder,
+ "Editor",
+ _("GtkSourceView Editor"),
+ ICON_FILE);
+
+ plugin->check_font = GTK_WIDGET (gtk_builder_get_object (builder,
+ FONT_USE_THEME_BUTTON));
+ g_signal_connect(G_OBJECT(plugin->check_font), "toggled",
+ G_CALLBACK(on_font_check_toggled), builder);
+ on_font_check_toggled (GTK_TOGGLE_BUTTON (plugin->check_font), builder);
/* Init styles combo */
- plugin->combo_styles = glade_xml_get_widget (gxml, COMBO_STYLES);
+ plugin->combo_styles = GTK_WIDGET (gtk_builder_get_object (builder, COMBO_STYLES));
gtk_combo_box_set_model (GTK_COMBO_BOX (plugin->combo_styles),
create_style_model(prefs, &iter));
g_signal_connect (plugin->combo_styles, "changed", G_CALLBACK (on_style_changed), plugin);
@@ -254,13 +266,13 @@
{
SourceviewPlugin* plugin = ANJUTA_PLUGIN_SOURCEVIEW (ipref);
g_signal_handlers_disconnect_by_func(G_OBJECT(plugin->check_font),
- G_CALLBACK(on_font_check_toggled), gxml);
+ G_CALLBACK(on_font_check_toggled), builder);
g_signal_handlers_disconnect_by_func(G_OBJECT(plugin->combo_styles),
- G_CALLBACK(on_style_changed), gxml);
+ G_CALLBACK(on_style_changed), builder);
anjuta_preferences_remove_page(prefs, _("GtkSourceView Editor"));
- g_object_unref(gxml);
- gxml = NULL;
+ g_object_unref(builder);
+ builder = NULL;
}
static void
Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c (original)
+++ trunk/plugins/sourceview/sourceview.c Tue Apr 7 10:19:20 2009
@@ -705,14 +705,12 @@
Sourceview *
sourceview_new(GFile* file, const gchar* filename, AnjutaPlugin* plugin)
{
- AnjutaShell* shell;
GtkAdjustment* v_adj;
Sourceview *sv = ANJUTA_SOURCEVIEW(g_object_new(ANJUTA_TYPE_SOURCEVIEW, NULL));
/* Apply Preferences */
- g_object_get(G_OBJECT(plugin), "shell", &shell, NULL);
- sv->priv->prefs = anjuta_shell_get_preferences(shell, NULL);
+ sv->priv->prefs = anjuta_preferences_default();
sourceview_prefs_init(sv);
sv->priv->plugin = plugin;
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Tue Apr 7 10:19:20 2009
@@ -168,6 +168,7 @@
plugins/profiler/profiler-function-call-tree.glade
plugins/profiler/profiler.glade
plugins/profiler/string-utils.c
+plugins/project-import/plugin.c
plugins/project-import/project-import.glade
plugins/project-import/project-import-dialog.c
plugins/project-manager/create_dialogs.glade
@@ -199,7 +200,7 @@
plugins/sourceview/sourceview.c
plugins/sourceview/sourceview-io.c
plugins/sourceview/sourceview-print.c
-plugins/sourceview/anjuta-editor-sourceview.glade
+plugins/sourceview/anjuta-editor-sourceview.ui
plugins/starter/plugin.c
plugins/starter/starter.c
plugins/subversion/anjuta-subversion.glade
Modified: trunk/scripts/Makefile.am
==============================================================================
--- trunk/scripts/Makefile.am (original)
+++ trunk/scripts/Makefile.am Tue Apr 7 10:19:20 2009
@@ -8,3 +8,5 @@
dist-hook:
cp $(srcdir)/glade2schema.pl $(distdir)
chmod +x $(distdir)/glade2schema.pl
+ cp $(srcdir)/builder2schema.pl $(distdir)
+ chmod +x $(distdir)/builder2schema.pl
\ No newline at end of file
Modified: trunk/scripts/build-schemas.mk
==============================================================================
--- trunk/scripts/build-schemas.mk (original)
+++ trunk/scripts/build-schemas.mk Tue Apr 7 10:19:20 2009
@@ -7,17 +7,30 @@
%.schemas: %.glade
$(top_srcdir)/scripts/glade2schema.pl $(srcdir)/$(?) > $(@)
+prefs_ui_schemasdir = @GCONF_SCHEMA_FILE_DIR@
+prefs_ui_schemas = $(prefs_ui_files:.ui=.schemas)
+prefs_ui_schemas_DATA = $(prefs_ui_schemas)
+
+%.schemas: %.ui
+ $(top_srcdir)/scripts/builder2schema.pl $(srcdir)/$(?) > $(@)
+
if GCONF_SCHEMAS_INSTALL
-install-data-local: $(prefs_glade_schemas)
+install-data-local: $(prefs_glade_schemas) $(prefs_ui_schemas)
for p in $(prefs_glade_schemas) ; do \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p ; \
+ done
+ for p in $(prefs_ui_schemas) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p ; \
done
@killall -1 gconfd-2 || true
-uninstall-local: $(prefs_glade_schemas)
+uninstall-local: $(prefs_glade_schemas) $(prefs_ui_schemas)
for p in $(prefs_glade_schemas) ; do \
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $$p ; \
done
+ for p in $(prefs_ui_schemas) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-uninstall-rule $$p ; \
+ done
@killall -1 gconfd-2 || true
else
Added: trunk/scripts/builder2schema.pl
==============================================================================
--- (empty file)
+++ trunk/scripts/builder2schema.pl Tue Apr 7 10:19:20 2009
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+use XML::Parser;
+
+%datatypes = (
+ "bool" => "bool",
+ "int" => "int",
+ "string" => "string",
+ "text" => "string",
+ "float" => "float",
+ "color" => "string",
+ "font" => "string",
+ "folder" => "string",
+ "file" => "string"
+);
+
+%boolean = (
+ 0 => "FALSE",
+ 1 => "TRUE"
+);
+
+$schema_path = "/schemas/apps/anjuta/preferences/";
+$key_path ="/apps/anjuta/preferences/";
+
+my $parser = new XML::Parser(Style => "Stream");
+print "<gconfschemafile>\n";
+print "\t<schemalist>\n";
+
+$parser->parsefile($ARGV[0]);
+
+print "\t</schemalist>\n";
+print "</gconfschemafile>\n";
+
+sub StartTag {
+ my $parser = shift;
+ my $key = shift;
+ if ($key =~ /object/) {
+ my $k = $_{"id"};
+ if ($k =~ /(preferences_color|entry|font|spin|text|toggle|menu|folder|file):(.*):(.*):(\d):(.*)/) {
+
+ my $type = $2;
+ my $default = $3;
+ my $flags = $4;
+ my $propkey = $5;
+
+
+ if ($type =~ /bool/) {
+ $default = $boolean{$default};
+ }
+
+
+
+ print "\t\t<schema>\n";
+ print "\t\t\t<key>$schema_path$propkey</key>\n";
+ print "\t\t\t<applyto>$key_path$propkey</applyto>\n";
+ print "\t\t\t<owner>anjuta</owner>\n";
+ print "\t\t\t<type>$datatypes{$type}</type>\n";
+ print "\t\t\t<default>$default</default>\n";
+
+ # Hack to keep gconftool happy
+ print "\t\t\t<locale name=\"C\" />\n";
+
+ print "\t\t</schema>\n\n";
+ }
+ }
+}
+
+sub EndTag {}
+
+sub Text {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]