[grisbi-cvs] [SCM] grisbi branch, grisbi-gtk3, updated. grisbi_gtk3_1_3_0-69-gd5b1bc3

julien fallou nobody at users.sourceforge.net
Sat Feb 4 21:40:48 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  d5b1bc3f4ad2013c2fee2e54608a8d686b8cb099 (commit)
       via  235ec968b6f8a9e0ec8f1095ebd9b388cc8b6365 (commit)
      from  3e6d320c808fb59df39edc640eb413843c9cd65b (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 d5b1bc3f4ad2013c2fee2e54608a8d686b8cb099
Author: jfallou <freak917 at users.sourceforge.net>
Date:   Sat Feb 4 21:35:57 2012 +0100

    Update code to manage dialogs edit category UI

commit 235ec968b6f8a9e0ec8f1095ebd9b388cc8b6365
Author: jfallou <freak917 at users.sourceforge.net>
Date:   Sat Feb 4 21:34:35 2012 +0100

    add dialogs edit category UI with and without radio buttons

-----------------------------------------------------------------------

Changes:
diff --git a/src/categories_onglet.c b/src/categories_onglet.c
index 275adb5..e4bd96e 100644
--- a/src/categories_onglet.c
+++ b/src/categories_onglet.c
@@ -495,15 +495,17 @@ void categories_importer_list ( void )
 	    if ( !last_transaction_number )
 		gsb_data_category_init_variables ();
 
-        case 1 :
-	    if ( !gsb_file_others_load_category ( category_name ))
-	    {
-		return;
-	    }
-	    break;
+	case 1 :
+		if ( !gsb_file_others_load_category ( category_name ))
+		{
+			return;
+		}
+		break;
+
 
 	default :
 	    return;
+	    break;
     }
 }
 
@@ -673,7 +675,7 @@ gboolean popup_category_view_mode_menu ( GtkWidget *button )
  */
 gboolean edit_category ( GtkTreeView *tree_view )
 {
-    GtkWidget * dialog, *paddingbox, *table, *label, *entry, *hbox, *radiogroup;
+    GtkWidget * dialog,*label,*entry;
     gint category_number = -1, sub_category_number = -1;
     GtkTreeSelection * selection;
     GtkTreeModel * model;
@@ -682,6 +684,8 @@ gboolean edit_category ( GtkTreeView *tree_view )
     GtkTreeIter *div_iter;
     MetatreeInterface *category_interface;
 
+    static GtkBuilder *widget_builder = NULL;
+
     /* fill category_number and sub_category_number */
 
     selection = gtk_tree_view_get_selection ( tree_view );
@@ -705,68 +709,41 @@ gboolean edit_category ( GtkTreeView *tree_view )
 										       0,
 										       _("No category defined") ));
 
-    dialog = gtk_dialog_new_with_buttons ( title,
-					   GTK_WINDOW ( run.window ),
-					   GTK_DIALOG_MODAL,
-					   GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
-					   GTK_STOCK_APPLY, GTK_RESPONSE_OK,
-					   NULL );
-
-    gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT );
-    gtk_window_set_resizable ( GTK_WINDOW ( dialog ), FALSE );
+    /* New GtkBuilder Creation*/
+    widget_builder = gtk_builder_new ( );
 
+    if ( widget_builder == NULL )
+    	return NULL;
 
-    /* Ugly dance to avoid side effects on dialog's vbox. */
-    hbox = gtk_hbox_new ( FALSE, 0 );
-    gtk_box_pack_start ( GTK_BOX ( dialog_get_content_area ( dialog ) ), hbox, FALSE, FALSE, 0 );
-    paddingbox = new_paddingbox_with_title ( hbox, TRUE, title );
-    gtk_container_set_border_width ( GTK_CONTAINER(hbox), 6 );
-    gtk_container_set_border_width ( GTK_CONTAINER(paddingbox), 6 );
-    g_free ( title );
 
-    table = gtk_table_new ( 0, 2, FALSE );
-    gtk_box_pack_start ( GTK_BOX ( paddingbox ), table, FALSE, FALSE, 6 );
-    gtk_table_set_col_spacings ( GTK_TABLE(table), 6 );
-    gtk_table_set_row_spacings ( GTK_TABLE(table), 6 );
-
-    /* Name entry */
-    label = gtk_label_new ( _("Name"));
-    gtk_misc_set_alignment ( GTK_MISC ( label ), 0.0, 0.5 );
-    gtk_table_attach ( GTK_TABLE(table), label, 0, 1, 0, 1,
-		       GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0 );
-
-    entry = gtk_entry_new ( );
     if ( sub_category_number > 0 )
     {
-	gtk_entry_set_text ( GTK_ENTRY ( entry ),
-			     gsb_data_category_get_sub_category_name ( category_number,
-								       sub_category_number,
-								       NULL ) );
+    	/* widget paddingbox XML loading */
+    	if ( !utils_gtkbuilder_merge_ui_data_in_builder ( widget_builder, "dlg_edit_category.ui" ) )
+    		return NULL;
     }
     else
     {
-	gtk_entry_set_text ( GTK_ENTRY ( entry ),
-			     gsb_data_category_get_name ( category_number, 0, NULL ) );
-    }
+    	/* widget paddingbox XML loading */
+    	if ( !utils_gtkbuilder_merge_ui_data_in_builder ( widget_builder, "dlg_edit_category_radio.ui" ) )
+    		return NULL;
 
-    gtk_widget_set_size_request ( entry, 400, -1 );
-    gtk_table_attach ( GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0 );
+    	g_object_set_data (G_OBJECT (gtk_builder_get_object ( widget_builder, "Debit_radiobutton" )),
+    			       "number_for_func", GINT_TO_POINTER (category_number));
 
-    if ( sub_category_number <= 0 )
-    {
-	/* Description entry */
-	label = gtk_label_new ( _("Type"));
-	gtk_misc_set_alignment ( GTK_MISC ( label ), 0.0, 0.5 );
-	gtk_table_attach ( GTK_TABLE(table), label, 0, 1, 1, 2,
-			   GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0 );
-
-	radiogroup = gsb_autofunc_radiobutton_new (  _("Credit"), _("Debit"),
-						     gsb_data_category_get_type (category_number),
-						     NULL, NULL,
-						     G_CALLBACK (gsb_data_category_set_type), category_number );
-	gtk_table_attach ( GTK_TABLE(table), radiogroup,
-			   1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0 );
-    }
+    	g_signal_connect ( G_OBJECT (gtk_builder_get_object ( widget_builder, "Debit_radiobutton" )), "toggled",
+    			G_CALLBACK (gsb_autofunc_checkbutton_changed), G_CALLBACK (gsb_data_category_set_type));
+	}
+
+    /* Get the needed widgets*/
+    dialog = GTK_WIDGET (gtk_builder_get_object ( widget_builder, "dialog_edit_category" ));
+    label = GTK_WIDGET (gtk_builder_get_object ( widget_builder, "label" ));
+    entry = GTK_WIDGET (gtk_builder_get_object ( widget_builder, "entry" ));
+
+
+    //Set Title
+    gtk_label_set_label(GTK_LABEL(label),title);
+    g_free ( title );
 
     gtk_widget_show_all ( dialog );
 
diff --git a/src/gsb_autofunc.c b/src/gsb_autofunc.c
index 69de8bb..9ce6a49 100644
--- a/src/gsb_autofunc.c
+++ b/src/gsb_autofunc.c
@@ -56,8 +56,8 @@
 /*END_INCLUDE*/
 
 /*START_STATIC*/
-static gboolean gsb_autofunc_checkbutton_changed ( GtkWidget *button,
-						   gboolean default_func (gint, gboolean));
+/*static gboolean gsb_autofunc_checkbutton_changed ( GtkWidget *button,
+						   gboolean default_func (gint, gboolean));*/
 static gboolean gsb_autofunc_combobox_changed ( GtkWidget *combobox,
 						gboolean default_func (gint, gint));
 static gboolean gsb_autofunc_currency_changed ( GtkWidget *combobox,
@@ -756,7 +756,7 @@ void gsb_autofunc_checkbutton_set_value ( GtkWidget *button,
  *
  * \return FALSE
  */
-static gboolean gsb_autofunc_checkbutton_changed ( GtkWidget *button,
+gboolean gsb_autofunc_checkbutton_changed ( GtkWidget *button,
 						   gboolean default_func (gint, gboolean))
 {
     gint number_for_func;
diff --git a/src/gsb_autofunc.h b/src/gsb_autofunc.h
index 7ec50c0..fe0da62 100644
--- a/src/gsb_autofunc.h
+++ b/src/gsb_autofunc.h
@@ -91,5 +91,8 @@ GtkWidget *gsb_autofunc_textview_new ( const gchar *value,
 void gsb_autofunc_textview_set_value ( GtkWidget *text_view,
 				       const gchar *value,
 				       gint number_for_func );
+
+gboolean gsb_autofunc_checkbutton_changed ( GtkWidget *button,
+						   gboolean default_func (gint, gboolean));
 /* END_DECLARATION */
 #endif
diff --git a/src/ui/dlg_edit_category.ui b/src/ui/dlg_edit_category.ui
index 837611f..53e6845 100644
--- a/src/ui/dlg_edit_category.ui
+++ b/src/ui/dlg_edit_category.ui
@@ -10,7 +10,7 @@
     <property name="type_hint">dialog</property>
     <property name="has_resize_grip">False</property>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+      <object class="GtkVBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
@@ -110,7 +110,6 @@
                           <object class="GtkTable" id="table">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="n_rows">2</property>
                             <property name="n_columns">2</property>
                             <property name="column_spacing">6</property>
                             <property name="row_spacing">6</property>
@@ -139,12 +138,6 @@
                                 <property name="y_options"></property>
                               </packing>
                             </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
                           </object>
                           <packing>
                             <property name="expand">True</property>
diff --git a/src/ui/dlg_edit_category_radio.ui b/src/ui/dlg_edit_category_radio.ui
new file mode 100644
index 0000000..32effd4
--- /dev/null
+++ b/src/ui/dlg_edit_category_radio.ui
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.24"/>
+  <object class="GtkDialog" id="dialog_edit_category">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="type_hint">dialog</property>
+    <property name="has_resize_grip">False</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">6</property>
+            <property name="spacing">18</property>
+            <child>
+              <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>
+                    <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>
+                  <object class="GtkHBox" id="hbox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">    </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="border_width">6</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkTable" id="table">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="n_rows">2</property>
+                            <property name="n_columns">2</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_spacing">6</property>
+                            <child>
+                              <object class="GtkLabel" id="label2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Name</property>
+                              </object>
+                              <packing>
+                                <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="entry">
+                                <property name="width_request">400</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">•</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="y_options"></property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label3">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Type</property>
+                              </object>
+                              <packing>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                                <property name="x_options">GTK_SHRINK | GTK_FILL</property>
+                                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkVBox" id="box2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">6</property>
+                                <child>
+                                  <object class="GtkRadioButton" id="Credit_radiobutton">
+                                    <property name="label" translatable="yes">Credit</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="xalign">0</property>
+                                    <property name="active">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="GtkRadioButton" id="Debit_radiobutton">
+                                    <property name="label" translatable="yes">Debit</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="xalign">0</property>
+                                    <property name="active">True</property>
+                                    <property name="draw_indicator">True</property>
+                                    <property name="group">Credit_radiobutton</property>
+                                  </object>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="right_attach">2</property>
+                                <property name="top_attach">1</property>
+                                <property name="bottom_attach">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button1</action-widget>
+      <action-widget response="-5">button2</action-widget>
+    </action-widgets>
+  </object>
+</interface>


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list