Fix problem focusing variable sheet
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 5 Mar 2009 09:14:45 +0000 (18:14 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 5 Mar 2009 09:14:45 +0000 (18:14 +0900)
lib/gtk-contrib/psppire-sheet.c
src/ui/gui/psppire-data-editor.c

index dac561a134b9b2ad99aac73c16699edab2852535..31ecbcbf5b17dfb30e9ff9590632d0d4157fa6de 100644 (file)
@@ -476,6 +476,11 @@ static void psppire_sheet_size_request              (GtkWidget *widget,
 static void psppire_sheet_size_allocate                 (GtkWidget *widget,
                                                  GtkAllocation *allocation);
 
+static gboolean psppire_sheet_focus_in               (GtkWidget     *widget,
+                                                     GdkEventFocus *event,
+                                                     gpointer       user_data);
+
+
 /* Sheet queries */
 
 static gboolean psppire_sheet_range_isvisible (const PsppireSheet *sheet,
@@ -1064,7 +1069,7 @@ psppire_sheet_class_init (PsppireSheetClass *klass)
   widget_class->expose_event = psppire_sheet_expose;
   widget_class->size_request = psppire_sheet_size_request;
   widget_class->size_allocate = psppire_sheet_size_allocate;
-  widget_class->focus_in_event = NULL;
+  widget_class->focus_in_event = psppire_sheet_focus_in;
   widget_class->focus_out_event = NULL;
 
   klass->set_scroll_adjustments = psppire_sheet_set_scroll_adjustments;
@@ -4052,6 +4057,20 @@ psppire_sheet_crossing_notify (GtkWidget *widget,
   return TRUE;
 }
 
+
+static gboolean
+psppire_sheet_focus_in (GtkWidget     *w,
+                       GdkEventFocus *event,
+                       gpointer       user_data)
+{
+  PsppireSheet *sheet = PSPPIRE_SHEET (w);
+
+  gtk_widget_grab_focus (sheet->entry_widget);
+
+  return TRUE;
+}
+
+
 static void
 psppire_sheet_extend_selection (PsppireSheet *sheet, gint row, gint column)
 {
@@ -4584,8 +4603,6 @@ set_entry_widget_font (PsppireSheet *sheet)
   gtk_widget_modify_style (sheet->entry_widget, style);
 }
 
-
-
 static void
 create_sheet_entry (PsppireSheet *sheet)
 {
index 735d4328c930b276f060f759e7024c687605de3b..2a05538db148b938848ce7c8aeb58bbd36280453 100644 (file)
@@ -548,6 +548,8 @@ psppire_data_editor_class_init (PsppireDataEditorClass *klass)
   object_class->set_property = psppire_data_editor_set_property;
   object_class->get_property = psppire_data_editor_get_property;
 
+  
+
   data_store_spec =
     g_param_spec_pointer ("data-store",
                          "Data Store",
@@ -990,11 +992,11 @@ psppire_data_editor_init (PsppireDataEditor *de)
                    G_CALLBACK (on_switch_page),
                    NULL);
 
+  g_object_set (de, "can-focus", FALSE, NULL);
 
   g_signal_connect (de, "map", G_CALLBACK (on_map), NULL);
 
 
-
   //     psppire_sheet_hide_column_titles (de->var_sheet);
   //  psppire_sheet_hide_row_titles (de->data_sheet);
 
@@ -1884,5 +1886,3 @@ on_owner_change (GtkClipboard *clip, GdkEventOwnerChange *event, gpointer data)
   g_signal_emit (de, data_editor_signals[DATA_AVAILABLE_CHANGED], 0,
                 compatible_target);
 }
-
-