[Glade-devel] My first patch
- From: xjuan_gq_nu yahoo com ar (Juan Pablo)
- Subject: [Glade-devel] My first patch
- Date: Wed, 20 Apr 2005 22:13:39 -0300
--=-TZ1wFH5yReIbBqMHlvBK
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello, Like I said before, I started with something easy.
I have added a new widget GtkAboutDialog and touched a little bit the
others dialogs so it will not show those extra buttonbox "spaces" but I
not sure that is the appropriate behavior.
Can anyone take o quick look at it?
I know its a stupid patch but I need someone to tell me if i am going
well or not. :D
--
Juan Pablo <xjuan_gq_nu yahoo com ar>
--=-TZ1wFH5yReIbBqMHlvBK
Content-Disposition: attachment; filename=aboutdialog.png
Content-Type: image/png; name=aboutdialog.png
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsRAAALEQF/ZF+RAAAAB3RJTUUH1QQUFyUEUivgPwAAAi1JREFUSMe1lT+v0mAUxn8tLTeG
oOEqQTYSBzZJRxLCAMGPwJ/P4GJc2F1ICJuziXMHE0YMDCZOkjAQjUa8idEJo6G20IIIdZA2QEsv
Vy8nedPmvKfnOc/znr5HAGxOY2fAUgJ4/+kLz190ryWrOdV5+uQRwC3gpwQweHfBy9eDawFYLizn
9Q6wEABb13Umk4nvB7IsIwjCzgI8PmdZlkUymQTIAhfSMVXN9B+8/fCM8GeTew8eErt992hGLsB2
ddsmCAK2YfDqzTfmwhmPRRFRFANZOOQBUQBswzDQNM0XIBQKEQ6HL69UklyJEokEQB74eCmDdrvt
8ZXLZVRVpVKpBDH4m9dhoOu6L4BTWZAc+4ccj8d3GWwHDIdDRqMR6XSaTCYTmPwQSOAh93o9ms0m
9XodRVFQVdWTqFqt0mw2SaVSrq9Wqx2WaDabYRiGy6Db7VIqlVAU5WDfOw2wf36WZXF+fu5K5AJM
p9Mry3AIIBaL+XcRgG3b2Lbt25p+gIfY7ZyB38ZyuUSW5R2fKIp0Oh0GA++9lc/nKRQK7k/oAdjf
AFitVq4MTly/36fRaOzEaZpGq9WiWCwGd5Gfrddrz9WgaZpvbKBEfgz8EuRyOVqtlmcvm80iiqJ/
m87ncxaLxdFX8qE4ANM0iUQiu100Ho+JRqOu7lcB8kw00/QyONFMvg98lTbD+SYQ38xRaQP8r/Yb
mALfAUvYJJOBGxsw6T8rXwO/AHPzPK39AQpAvGqLPL23AAAAAElFTkSuQmCC
--=-TZ1wFH5yReIbBqMHlvBK
Content-Disposition: attachment; filename=about_dialog.patch
Content-Type: text/x-patch; name=about_dialog.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Index: src/glade-gtk.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-gtk.c,v
retrieving revision 1.63
diff -u -r1.63 glade-gtk.c
--- src/glade-gtk.c 10 Apr 2005 06:31:04 -0000 1.63
+++ src/glade-gtk.c 21 Apr 2005 00:18:16 -0000
@@ -1301,6 +1301,48 @@
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
}
+/**
+ * glade_gtk_about_dialog_post_create:
+ * @object:
+ *
+ * TODO: write me
+ */
+void GLADEGTK_API
+glade_gtk_about_dialog_post_create (GObject *object)
+{
+ GtkWidget *about = GTK_WIDGET (object);
+ GladeWidget *glade_widget;
+ GladeProperty *pname;
+ const gchar *pname_str;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ glade_widget = glade_widget_get_from_gobject (about);
+ pname = glade_widget_get_property (glade_widget, "name");
+
+ /* Ops!!! I do not know what happen */
+ if (pname == NULL) return;
+
+ /* If there is no program`s name set, this will put something to show in glade. */
+ pname_str = g_value_get_string(pname->value);
+ if (pname_str == NULL || strcmp(pname_str, "") == 0) {
+ GladeProject *project = glade_widget_get_project (glade_widget);
+ gchar *suffix, *new_pname_str;
+
+ /* Get project name */
+ new_pname_str = g_strdup(project->name);
+
+ /* I do not want the suffix :D */
+ suffix = g_strrstr(new_pname_str, ".glade");
+ if (suffix != NULL) *suffix = '\0';
+
+ /* Set the program`s name */
+ g_value_set_string(pname->value, new_pname_str);
+ gtk_about_dialog_set_name (GTK_ABOUT_DIALOG(about), new_pname_str);
+ g_free (new_pname_str);
+ }
+}
+
/* ------------------------ Replace child functions ------------------------ */
/**
* glade_gtk_container_replace_child:
@@ -1444,9 +1486,11 @@
{
g_return_if_fail (GTK_IS_DIALOG (dialog));
- /* add a placeholder in the vbox */
- gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ /* add a placeholder in the vbox if it is not an AboutDialog */
+ if (! GTK_IS_ABOUT_DIALOG(dialog))
+ gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),
glade_placeholder_new ());
+
}
/**
Index: widgets/gtk+.xml
===================================================================
RCS file: /cvs/gnome/glade3/widgets/gtk+.xml,v
retrieving revision 1.3
diff -u -r1.3 gtk+.xml
--- widgets/gtk+.xml 10 Apr 2005 06:31:05 -0000 1.3
+++ widgets/gtk+.xml 21 Apr 2005 00:18:22 -0000
@@ -441,14 +441,20 @@
-->
<!-- Gtk+ Dialogs -->
- <glade-widget-class name="GtkColorSelectionDialog" generic-name="colorselectiondialog" title="Color
Selection Dialog"/>
-
+ <glade-widget-class name="GtkColorSelectionDialog" generic-name="colorselectiondialog" title="Color
Selection Dialog">
+ <post-create-function>empty</post-create-function>
+ </glade-widget-class>
+
<glade-widget-class name="GtkFileChooserDialog" generic-name="filechooserdialog" title="File Chooser
Dialog"/>
-
- <glade-widget-class name="GtkFontSelectionDialog" generic-name="fontselectiondialog" title="Font
Selection Dialog"/>
-
- <glade-widget-class name="GtkInputDialog" generic-name="inputdialog" title="Input Dialog"/>
-
+
+ <glade-widget-class name="GtkFontSelectionDialog" generic-name="fontselectiondialog" title="Font
Selection Dialog">
+ <post-create-function>empty</post-create-function>
+ </glade-widget-class>
+
+ <glade-widget-class name="GtkInputDialog" generic-name="inputdialog" title="Input Dialog">
+ <post-create-function>empty</post-create-function>
+ </glade-widget-class>
+
<glade-widget-class name="GtkMessageDialog" generic-name="messagedialog" title="Message Dialog">
<post-create-function>glade_gtk_message_dialog_post_create</post-create-function>
@@ -466,6 +472,15 @@
<property common="True" id="can-focus"/>
</properties>
</glade-widget-class>
+ <glade-widget-class name="GtkAboutDialog" generic-name="aboutdialog" title="About Dialog">
+ <post-create-function>glade_gtk_about_dialog_post_create</post-create-function>
+ <fill-empty-function>ignore</fill-empty-function>
+ <properties>
+ <property id="name" name="Program name" default="">
+ <tooltip>The name of the program</tooltip>
+ </property>
+ </properties>
+ </glade-widget-class>
<!-- Gtk+ Obsolete -->
<glade-widget-class name="GtkRuler">
@@ -545,6 +560,7 @@
<glade-widget-class-ref name="GtkFontSelectionDialog"/>
<glade-widget-class-ref name="GtkInputDialog"/>
<glade-widget-class-ref name="GtkMessageDialog"/>
+ <glade-widget-class-ref name="GtkAboutDialog"/>
</glade-widget-group>
<glade-widget-group name="gtk-obsolete" title="Gtk+ Obsolete">
--=-TZ1wFH5yReIbBqMHlvBK--
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]