[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. grisbi_gtk3_1_3_0-66-gbd1cd42
julien fallou
nobody at users.sourceforge.net
Thu Feb 2 21:28:44 CET 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".
The branch, grisbi-gtk3 has been updated
via bd1cd42280a12e6afe8a02032ee753676091b3c2 (commit)
via 362a2bf29c84eebe7a51060fc35e19f87084b0b6 (commit)
via fe4759b49b89b6fd7ae66bb8653bdb0832b7eb4f (commit)
from 028d3916bb5bfd234f1625d073b7287940e8683a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bd1cd42280a12e6afe8a02032ee753676091b3c2
Author: jfallou <freak917 at users.sourceforge.net>
Date: Thu Feb 2 21:27:10 2012 +0100
Update new_paddingbox_with_title function to use corresponding UI
commit 362a2bf29c84eebe7a51060fc35e19f87084b0b6
Author: jfallou <freak917 at users.sourceforge.net>
Date: Thu Feb 2 21:13:21 2012 +0100
Simplify the UI
commit fe4759b49b89b6fd7ae66bb8653bdb0832b7eb4f
Author: jfallou <freak917 at users.sourceforge.net>
Date: Thu Feb 2 21:07:16 2012 +0100
add widget paddingbox with title UI
-----------------------------------------------------------------------
Changes:
diff --git a/src/ui/wdg_paddingbox_with_title.ui b/src/ui/wdg_paddingbox_with_title.ui
new file mode 100644
index 0000000..5cc657b
--- /dev/null
+++ b/src/ui/wdg_paddingbox_with_title.ui
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.24"/>
+ <object class="GtkVBox" id="vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">1</property>
+ <property name="label"></property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <object class="GtkHBox" id="hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <!-- Some padding. ugly but the HiG advises it this way ;-) -->
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="no"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="paddingbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/src/utils.c b/src/utils.c
index d607918..c74202d 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -294,52 +294,61 @@ gboolean lance_navigateur_web ( const gchar *uri )
*/
GtkWidget *new_paddingbox_with_title (GtkWidget *parent, gboolean fill, const gchar *title)
{
- GtkWidget *vbox, *hbox, *paddingbox, *label;
- gchar* tmp_str;
-
- vbox = gtk_vbox_new ( FALSE, 6 );
- if ( GTK_IS_BOX(parent) )
- {
- gtk_box_pack_start ( GTK_BOX ( parent ), vbox,
- fill, fill, 0);
- }
-
- /* Creating label */
- label = gtk_label_new ( NULL );
- gtk_misc_set_alignment ( GTK_MISC ( label ), 0, 1 );
- tmp_str = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>", title );
- gtk_label_set_markup ( GTK_LABEL ( label ), tmp_str );
- g_free(tmp_str);
- gtk_box_pack_start ( GTK_BOX ( vbox ), label,
- FALSE, FALSE, 0);
- gtk_widget_show ( label );
-
- /* Creating horizontal box */
- hbox = gtk_hbox_new ( FALSE, 0 );
- gtk_box_pack_start ( GTK_BOX ( vbox ), hbox,
- fill, fill, 0);
-
- /* Some padding. ugly but the HiG advises it this way ;-) */
- label = gtk_label_new ( " " );
- gtk_box_pack_start ( GTK_BOX ( hbox ), label,
- FALSE, FALSE, 0 );
-
- /* Then make the vbox itself */
- paddingbox = gtk_vbox_new ( FALSE, 6 );
- gtk_box_pack_start ( GTK_BOX ( hbox ), paddingbox,
- TRUE, TRUE, 0);
-
- /* Put a label at the end to feed a new line */
- /* label = gtk_label_new ( " " ); */
- /* gtk_box_pack_end ( GTK_BOX ( paddingbox ), label, */
- /* FALSE, FALSE, 0 ); */
-
- if ( GTK_IS_BOX(parent) )
- {
- gtk_box_set_spacing ( GTK_BOX(parent), 18 );
- }
-
- return paddingbox;
+ GtkWidget *vbox = NULL, *hbox = NULL, *paddingbox = NULL, *label = NULL;
+ static GtkBuilder *widget_builder = NULL;
+
+
+ /* New GtkBuilder Creation*/
+ widget_builder = gtk_builder_new ( );
+
+ if ( widget_builder == NULL )
+ return NULL;
+
+ /* widget paddingbox XML loading */
+ if ( !utils_gtkbuilder_merge_ui_data_in_builder ( widget_builder, "wdg_paddingbox_with_title.ui" ) )
+ return NULL;
+
+ /* Get the needed widgets*/
+ vbox = GTK_WIDGET ( gtk_builder_get_object ( widget_builder, "vbox" ) );
+ paddingbox = GTK_WIDGET ( gtk_builder_get_object ( widget_builder, "paddingbox" ));
+ label = GTK_WIDGET ( gtk_builder_get_object ( widget_builder, "label" ) );
+ hbox = GTK_WIDGET ( gtk_builder_get_object (widget_builder, "hbox"));
+
+ /*Check Validity of Parent for robustness case*/
+ if (parent != NULL && GTK_IS_BOX(parent) )
+ {
+ if (vbox != NULL)
+ {
+ gtk_box_pack_start ( GTK_BOX ( parent ), vbox,
+ fill, fill, 0);
+ }
+ else
+ {
+ /*Nothing to do
+ * Cosmetic error : Minor
+ */
+
+ }
+ }
+
+ if (label != NULL)
+ {
+ gtk_label_set_label(label,title);
+ }
+ else
+ {
+ return NULL; //TODO Manage error
+ }
+
+ gtk_box_pack_start ( GTK_BOX ( vbox ), hbox,
+ fill, fill, 0);
+
+ if ( parent != NULL && GTK_IS_BOX(parent) )
+ {
+ gtk_box_set_spacing ( GTK_BOX(parent), 18 );
+ }
+
+ return paddingbox;
}
/**
hooks/post-receive
--
grisbi
More information about the cvs
mailing list