[grisbi-cvs] [SCM] grisbi branch, master, updated. b2cc0761bfe050b5ca1590bfdba8a38ca87993a4

Pierre Biava nobody at users.sourceforge.net
Sun Jul 4 21:24:21 CEST 2010


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, master has been updated
       via  b2cc0761bfe050b5ca1590bfdba8a38ca87993a4 (commit)
       via  bb9708aa827466f32d02dc08cc39635e17d826eb (commit)
      from  071c333b3443b278ae37c042a7f9ee751fb0ec7f (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 b2cc0761bfe050b5ca1590bfdba8a38ca87993a4
Author: pbiava <pierre.biava at nerim.net>
Date:   Sun Jul 4 21:23:35 2010 +0200

    Formatting text

commit bb9708aa827466f32d02dc08cc39635e17d826eb
Author: pbiava <pierre.biava at nerim.net>
Date:   Sun Jul 4 21:22:40 2010 +0200

    Fixed bug when using the ESC key

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

Changes:
diff --git a/src/gtk_combofix.c b/src/gtk_combofix.c
index c07f1b9..743ed78 100644
--- a/src/gtk_combofix.c
+++ b/src/gtk_combofix.c
@@ -88,6 +88,9 @@ static gboolean gtk_combofix_button_release_event ( GtkWidget *popup,
 static gboolean gtk_combofix_button_press ( GtkWidget *popup,
                         GdkEventButton *ev,
                         GtkComboFix *combofix );
+static gboolean gtk_combofix_focus_in ( GtkWidget *entry,
+                        GdkEvent *ev,
+                        GtkComboFix *combofix );
 static gboolean  gtk_combofix_focus_out ( GtkWidget *entry,
                         GdkEvent *ev,
                         GtkComboFix *combofix );
@@ -624,27 +627,32 @@ static void gtk_combofix_init ( GtkComboFix *combofix )
     /* set the entry */
     combofix -> entry = gtk_entry_new ( );
     g_signal_connect ( G_OBJECT ( combofix -> entry ),
-                            "key-press-event",
-                            G_CALLBACK ( gtk_combofix_key_press_event ),
-                            combofix );
+                        "key-press-event",
+                        G_CALLBACK ( gtk_combofix_key_press_event ),
+                        combofix );
     g_signal_connect_object ( G_OBJECT ( combofix -> entry ),
-                            "insert-text",
-                            G_CALLBACK ( gtk_combofix_entry_insert ),
-                            combofix,
-                            G_CONNECT_AFTER | G_CONNECT_SWAPPED );
+                        "insert-text",
+                        G_CALLBACK ( gtk_combofix_entry_insert ),
+                        combofix,
+                        G_CONNECT_AFTER | G_CONNECT_SWAPPED );
     g_signal_connect_object ( G_OBJECT ( combofix -> entry ),
-                            "delete-text",
-                            G_CALLBACK ( gtk_combofix_entry_delete ),
-                            combofix,
-                            G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+                        "delete-text",
+                        G_CALLBACK ( gtk_combofix_entry_delete ),
+                        combofix,
+                        G_CONNECT_AFTER | G_CONNECT_SWAPPED);
     g_signal_connect_swapped ( G_OBJECT ( combofix -> entry ),
-                            "expose-event",
-                            G_CALLBACK ( gtk_combofix_expose_entry ),
-                            combofix );
+                        "expose-event",
+                        G_CALLBACK ( gtk_combofix_expose_entry ),
+                        combofix );
     g_signal_connect_after ( G_OBJECT ( combofix -> entry ),
-                            "focus-out-event",
-                            G_CALLBACK ( gtk_combofix_focus_out ),
-                            combofix );
+                        "focus-in-event",
+                        G_CALLBACK ( gtk_combofix_focus_in ),
+                        combofix );
+
+    g_signal_connect_after ( G_OBJECT ( combofix -> entry ),
+                        "focus-out-event",
+                        G_CALLBACK ( gtk_combofix_focus_out ),
+                        combofix );
     gtk_box_pack_start ( GTK_BOX ( hbox ), combofix -> entry, TRUE, TRUE, 0 );
     gtk_widget_show ( combofix -> entry );
 
@@ -652,30 +660,30 @@ static void gtk_combofix_init ( GtkComboFix *combofix )
     priv -> button = gtk_button_new ( );
     gtk_button_set_relief ( GTK_BUTTON ( priv -> button ), GTK_RELIEF_NONE );
     gtk_container_add ( GTK_CONTAINER ( priv -> button ),
-                            gtk_arrow_new ( GTK_ARROW_DOWN, GTK_SHADOW_NONE) );
+                        gtk_arrow_new ( GTK_ARROW_DOWN, GTK_SHADOW_NONE) );
     g_signal_connect_swapped ( G_OBJECT ( priv -> button ),
-                            "clicked",
-                            G_CALLBACK ( gtk_combofix_show_popup ),
-                            combofix );
+                        "clicked",
+                        G_CALLBACK ( gtk_combofix_show_popup ),
+                        combofix );
     gtk_box_pack_start ( GTK_BOX ( hbox ), priv -> button, FALSE, FALSE, 0 );
     gtk_widget_show_all ( priv -> button );
 
     /* set the popup but don't show it */
     priv -> popup = gtk_window_new ( GTK_WINDOW_POPUP );
     g_signal_connect ( G_OBJECT ( priv -> popup ),
-                            "key-press-event",
-                            G_CALLBACK (gtk_combofix_popup_key_press_event),
-                            combofix );
+                        "key-press-event",
+                        G_CALLBACK (gtk_combofix_popup_key_press_event),
+                        combofix );
     gtk_window_set_resizable ( GTK_WINDOW ( priv -> popup ), FALSE );
 
     g_signal_connect ( G_OBJECT ( priv -> popup ),
-                            "button-press-event",
-                            G_CALLBACK ( gtk_combofix_button_press ),
-                            combofix );
+                        "button-press-event",
+                        G_CALLBACK ( gtk_combofix_button_press ),
+                        combofix );
     g_signal_connect ( G_OBJECT ( priv -> popup ),
-                            "button-release-event",
-                            G_CALLBACK ( gtk_combofix_button_release_event ),
-                            combofix );
+                        "button-release-event",
+                        G_CALLBACK ( gtk_combofix_button_release_event ),
+                        combofix );
 
     frame = gtk_frame_new ( NULL );
     gtk_container_add ( GTK_CONTAINER ( priv -> popup ), frame );
@@ -683,8 +691,8 @@ static void gtk_combofix_init ( GtkComboFix *combofix )
 
     scrolled_window = gtk_scrolled_window_new ( FALSE, FALSE );
     gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW(scrolled_window),
-                            GTK_POLICY_AUTOMATIC,
-                            GTK_POLICY_AUTOMATIC );
+                        GTK_POLICY_AUTOMATIC,
+                        GTK_POLICY_AUTOMATIC );
     gtk_container_add ( GTK_CONTAINER (frame), scrolled_window );
     gtk_widget_show (scrolled_window);
 
@@ -697,10 +705,9 @@ static void gtk_combofix_init ( GtkComboFix *combofix )
                         G_TYPE_BOOLEAN );
 
     /* we set the store in a filter to show only what is selected */
-    priv -> model_filter = gtk_tree_model_filter_new ( GTK_TREE_MODEL ( priv -> store),
-                                   NULL );
+    priv -> model_filter = gtk_tree_model_filter_new ( GTK_TREE_MODEL ( priv -> store), NULL );
     gtk_tree_model_filter_set_visible_column ( GTK_TREE_MODEL_FILTER ( priv -> model_filter ),
-                           COMBOFIX_COL_VISIBLE );
+                        COMBOFIX_COL_VISIBLE );
 
     /* we set the filter in a sorting model */
     priv -> model_sort = gtk_tree_model_sort_new_with_model ( GTK_TREE_MODEL (
@@ -716,35 +723,31 @@ static void gtk_combofix_init ( GtkComboFix *combofix )
     /* make the column */
     cell_renderer = gtk_cell_renderer_text_new ();
     tree_view_column = gtk_tree_view_column_new_with_attributes ( "",
-                                      cell_renderer,
-                                      "text", COMBOFIX_COL_VISIBLE_STRING,
-                                      NULL );
+                                    cell_renderer,
+                                    "text", COMBOFIX_COL_VISIBLE_STRING,
+                                    NULL );
     gtk_tree_view_column_set_sizing ( tree_view_column,
-                      GTK_TREE_VIEW_COLUMN_FIXED );
+                        GTK_TREE_VIEW_COLUMN_FIXED );
 
     /* set the sorting model in the tree view */
     priv -> tree_view = gtk_tree_view_new_with_model (
-                            GTK_TREE_MODEL ( priv -> model_sort ) );
+                                    GTK_TREE_MODEL ( priv -> model_sort ) );
 
     priv -> selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( priv -> tree_view ) );
     gtk_tree_selection_set_mode ( GTK_TREE_SELECTION ( priv -> selection ),
-                            GTK_SELECTION_SINGLE );
-    gtk_tree_view_set_hover_selection ( GTK_TREE_VIEW ( priv -> tree_view ),
-                            TRUE );
-    gtk_tree_view_set_headers_visible ( GTK_TREE_VIEW ( priv -> tree_view ),
-                            FALSE );
-    gtk_tree_view_append_column ( GTK_TREE_VIEW ( priv -> tree_view ),
-                            tree_view_column );
-    gtk_tree_view_set_fixed_height_mode ( GTK_TREE_VIEW ( priv -> tree_view ),
-                            TRUE );
+                        GTK_SELECTION_SINGLE );
+    gtk_tree_view_set_hover_selection ( GTK_TREE_VIEW ( priv -> tree_view ), TRUE );
+    gtk_tree_view_set_headers_visible ( GTK_TREE_VIEW ( priv -> tree_view ), FALSE );
+    gtk_tree_view_append_column ( GTK_TREE_VIEW ( priv -> tree_view ), tree_view_column );
+    gtk_tree_view_set_fixed_height_mode ( GTK_TREE_VIEW ( priv -> tree_view ), TRUE );
     gtk_tree_view_set_row_separator_func ( GTK_TREE_VIEW ( priv -> tree_view ),
-                           (GtkTreeViewRowSeparatorFunc) gtk_combofix_separator_func,
-                           combofix, NULL );
+                        (GtkTreeViewRowSeparatorFunc) gtk_combofix_separator_func,
+                        combofix, NULL );
 
     g_signal_connect ( G_OBJECT ( priv -> tree_view ),
-                            "button-press-event",
-                            G_CALLBACK ( gtk_combofix_button_press_event ),
-                            combofix );
+                        "button-press-event",
+                        G_CALLBACK ( gtk_combofix_button_press_event ),
+                        combofix );
     gtk_container_add ( GTK_CONTAINER ( scrolled_window ), priv -> tree_view );
 
     gtk_widget_show ( priv -> tree_view );
@@ -1386,6 +1389,36 @@ static gboolean gtk_combofix_focus_out ( GtkWidget *entry,
 }
 
 
+/**
+ * called when the entry receive a focus in event
+ * 
+ *
+ * \param entry
+ * \param ev
+ * \param combofix
+ *
+ * \return FALSE
+ * */
+static gboolean gtk_combofix_focus_in ( GtkWidget *entry,
+                        GdkEvent *ev,
+                        GtkComboFix *combofix )
+{
+    const gchar *text;
+    GtkComboFixPrivate *priv = GTK_COMBOFIX_GET_PRIVATE ( combofix );
+
+    text = gtk_entry_get_text ( GTK_ENTRY ( combofix -> entry ) );
+
+    if ( priv -> old_entry && strlen ( priv -> old_entry ) )
+        g_free ( priv -> old_entry );
+
+    if ( text && strlen ( text ) )
+        priv -> old_entry = g_strdup ( text );
+    else
+        priv -> old_entry = NULL;
+
+    return ( FALSE );
+}
+
 
 /**
  * the popup need to be modal to work fine, but the entry won't receive
@@ -1453,6 +1486,7 @@ static gboolean gtk_combofix_key_press_event ( GtkWidget *entry,
         if ( GTK_WIDGET_VISIBLE ( priv -> popup ))
         {
             gtk_combofix_hide_popup ( combofix );
+            gtk_combofix_set_text ( combofix, priv -> old_entry );
             gtk_editable_select_region ( GTK_EDITABLE ( combofix -> entry ), 0, 0 );
             return TRUE;
         }


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list