Implemented the recently used files menus.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 3 Apr 2007 10:08:59 +0000 (10:08 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 3 Apr 2007 10:08:59 +0000 (10:08 +0000)
src/ui/gui/ChangeLog
src/ui/gui/data-editor.c
src/ui/gui/data-editor.glade
src/ui/gui/helper.h
src/ui/gui/syntax-editor.c
src/ui/gui/syntax-editor.h

index b2790bf1eafdd7aa465c2c67428899f77fba9751..3a578f7ef09699e2fc0dfe46ca2786478d92d1b2 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-03   John Darrington <john@darrington.wattle.id.au>
+       
+       * data-editor.c data-editor.glade helper.h syntax-editor.c
+       syntax-editor.h : Implemented the File->Recently_Used_ menus.
+
+
 2007-03-31   John Darrington <john@darrington.wattle.id.au>
         
        * data-editor.c data-editor.glade data-editor.h dialog-common.c
index 81ebfb3c60259ab582cb6c010c34532e4c983850..5a0f83581953d82d1d671f4ef1c963022dbf00d3 100644 (file)
@@ -54,6 +54,7 @@ static void register_data_editor_actions (struct data_editor *de);
 static void insert_variable (GtkCheckMenuItem *m, gpointer data);
 
 
+
 /* Switch between the VAR SHEET and the DATA SHEET */
 enum {PAGE_DATA_SHEET = 0, PAGE_VAR_SHEET};
 
@@ -115,6 +116,56 @@ disable_edit_clear (GtkWidget *w, gint x, gint y, gpointer data)
   return FALSE;
 }
 
+static void open_data_file (const gchar *, struct data_editor *);
+
+
+
+#if RECENT_LISTS_AVAILABLE
+
+static void
+on_recent_data_select (GtkMenuShell *menushell,   gpointer user_data)
+{
+  gchar *file;
+
+  struct data_editor *de = user_data;
+
+  gchar *uri =
+    gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
+
+  file = g_filename_from_uri (uri, NULL, NULL);
+
+  g_free (uri);
+
+  open_data_file (file, de);
+
+  g_free (file);
+}
+
+static void
+on_recent_files_select (GtkMenuShell *menushell,   gpointer user_data)
+{
+  gchar *file;
+
+  struct syntax_editor *se ;
+
+  gchar *uri =
+    gtk_recent_chooser_get_current_uri (GTK_RECENT_CHOOSER (menushell));
+
+  file = g_filename_from_uri (uri, NULL, NULL);
+
+  g_free (uri);
+
+  se = (struct syntax_editor *)
+    window_create (WINDOW_SYNTAX, file);
+
+  load_editor_from_file (se, file, NULL);
+
+  g_free (file);
+}
+
+#endif
+
+
 
 /*
   Create a new data editor.
@@ -211,6 +262,45 @@ new_data_editor (void)
                            G_CALLBACK (gtk_action_activate),
                            de->action_data_open);
 
+
+#if RECENT_LISTS_AVAILABLE
+  {
+    GtkRecentManager *rm = gtk_recent_manager_get_default ();
+    GtkWidget *recent_data = get_widget_assert (de->xml, "file_recent-data");
+    GtkWidget *recent_files = get_widget_assert (de->xml, "file_recent-files");
+
+    GtkWidget *menu = gtk_recent_chooser_menu_new_for_manager (rm);
+
+    GtkRecentFilter *filter = gtk_recent_filter_new ();
+
+    gtk_recent_filter_add_pattern (filter, "*.sav");
+    gtk_recent_filter_add_pattern (filter, "*.SAV");
+
+    gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+
+    gtk_widget_set_sensitive (recent_data, TRUE);
+    g_signal_connect (menu, "selection-done",
+                     G_CALLBACK (on_recent_data_select), de);
+
+    gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_data), menu);
+
+
+    filter = gtk_recent_filter_new ();
+    menu = gtk_recent_chooser_menu_new_for_manager (rm);
+
+    gtk_recent_filter_add_pattern (filter, "*.sps");
+    gtk_recent_filter_add_pattern (filter, "*.SPS");
+
+    gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (menu), filter);
+
+    gtk_widget_set_sensitive (recent_files, TRUE);
+    g_signal_connect (menu, "selection-done",
+                     G_CALLBACK (on_recent_files_select), de);
+
+    gtk_menu_item_set_submenu (GTK_MENU_ITEM (recent_files), menu);
+  }
+#endif
+
   g_signal_connect (get_widget_assert (de->xml,"file_new_syntax"),
                    "activate",
                    G_CALLBACK (new_syntax_window),
@@ -1009,6 +1099,26 @@ new_file (GtkAction *action, struct editor_window *e)
 }
 
 
+static void
+open_data_file (const gchar *file_name, struct data_editor *de)
+{
+  struct getl_interface *sss;
+  struct string filename;
+
+  ds_init_cstr (&filename, file_name);
+
+  gen_quoted_string (&filename);
+
+  sss = create_syntax_string_source ("GET FILE=%s.",
+                                    ds_cstr (&filename));
+
+  execute_syntax (sss);
+  ds_destroy (&filename);
+
+  window_set_name_from_filename ((struct editor_window *) de, file_name);
+}
+
+
 /* Callback for the data_open action.
    Prompts for a filename and opens it */
 static void
@@ -1045,23 +1155,24 @@ open_data_dialog (GtkAction *action, struct data_editor *de)
     {
     case GTK_RESPONSE_ACCEPT:
       {
-       struct getl_interface *sss;
-       struct string filename;
        g_free (de->file_name);
        de->file_name =
          gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
 
-       ds_init_cstr (&filename, de->file_name);
+       open_data_file (de->file_name, de);
 
-       gen_quoted_string (&filename);
+#if RECENT_LISTS_AVAILABLE
+       {
+         GtkRecentManager *manager = gtk_recent_manager_get_default();
+         gchar *uri = g_filename_to_uri (de->file_name, NULL, NULL);
 
-       sss = create_syntax_string_source ("GET FILE=%s.",
-                                          ds_cstr (&filename));
+         if ( ! gtk_recent_manager_add_item (manager, uri))
+           g_warning ("Could not add item %s to recent list\n",uri);
 
-       execute_syntax (sss);
-       ds_destroy (&filename);
+         g_free (uri);
+       }
+#endif
 
-       window_set_name_from_filename (e, de->file_name);
       }
       break;
     default:
@@ -1070,7 +1181,3 @@ open_data_dialog (GtkAction *action, struct data_editor *de)
 
   gtk_widget_destroy (dialog);
 }
-
-
-
-
index 71e977be8ac3f2e0d05aca4e221dc54a1834f996..8761fc93a35d61779b9eb44117f28a6a10b28516 100644 (file)
                         <property name="use_stock">True</property>
                       </widget>
                     </child>
+                    <child>
+                      <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="file_recent-data">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Recently Used Da_ta</property>
+                        <property name="use_underline">True</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="file_recent-files">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Recently Used _Files</property>
+                        <property name="use_underline">True</property>
+                      </widget>
+                    </child>
                     <child>
                       <widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
                         <property name="visible">True</property>
                     <property name="visible">True</property>
                     <property name="sensitive">False</property>
                     <property name="tooltip" translatable="yes">Recall</property>
-                    <property name="stock_id">pspp-recent-dialogs</property>
+                    <property name="stock_id">gtk-missing-image</property>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
                   </packing>
                 </child>
-
                 <child>
                   <widget class="GtkSeparatorToolItem" id="separatortoolitem1">
                     <property name="visible">True</property>
                     <property name="n_rows">1</property>
                     <property name="n_columns">2</property>
                     <child>
-                      <widget class="GtkEntry" id="entry4">
+                      <widget class="GtkEntry" id="cell_ref_entry">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="editable">False</property>
+                        <property name="width_chars">25</property>
                       </widget>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="cell_ref_entry">
+                      <widget class="GtkEntry" id="entry4">
                         <property name="visible">True</property>
-                        <property name="sensitive">False</property>
-                        <property name="editable">False</property>
-                        <property name="width_chars">25</property>
+                        <property name="can_focus">True</property>
                       </widget>
                       <packing>
-                        <property name="x_options">GTK_FILL</property>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
                         <property name="y_options"></property>
                       </packing>
                     </child>
                 <property name="column_spacing">2</property>
                 <property name="row_spacing">1</property>
                 <child>
-                  <widget class="GtkHBox" id="hbox2">
+                  <widget class="GtkLabel" id="decimals_label">
                     <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkLabel" id="width_label">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">Width:</property>
-                        <property name="justify">GTK_JUSTIFY_RIGHT</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="pack_type">GTK_PACK_END</property>
-                      </packing>
-                    </child>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Decimal Places:</property>
+                    <property name="justify">GTK_JUSTIFY_RIGHT</property>
                   </widget>
                   <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options">GTK_FILL</property>
+                    <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="decimals_entry">
+                  <widget class="GtkEntry" id="width_entry">
                     <property name="width_request">25</property>
-                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </widget>
                   <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>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkEntry" id="width_entry">
+                  <widget class="GtkEntry" id="decimals_entry">
                     <property name="width_request">25</property>
+                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </widget>
                   <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>
                     <property name="y_options"></property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="decimals_label">
+                  <widget class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">Decimal Places:</property>
-                    <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                    <child>
+                      <widget class="GtkLabel" id="width_label">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Width:</property>
+                        <property name="justify">GTK_JUSTIFY_RIGHT</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="pack_type">GTK_PACK_END</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="top_attach">1</property>
-                    <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
-                    <property name="y_options"></property>
+                    <property name="y_options">GTK_FILL</property>
                   </packing>
                 </child>
               </widget>
                     <property name="n_columns">2</property>
                     <property name="row_spacing">5</property>
                     <child>
-                      <widget class="GtkScrolledWindow" id="scrolledwindow3">
+                      <widget class="GtkVButtonBox" id="vbuttonbox2">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
-                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                        <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+                        <property name="border_width">5</property>
                         <child>
-                          <widget class="GtkTreeView" id="treeview1">
+                          <widget class="GtkButton" id="val_labs_add">
                             <property name="visible">True</property>
+                            <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
-                            <property name="headers_visible">False</property>
-                            <property name="enable_search">False</property>
+                            <property name="can_default">True</property>
+                            <property name="label">gtk-add</property>
+                            <property name="use_stock">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="val_labs_change">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                            <property name="label">gtk-apply</property>
+                            <property name="use_stock">True</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="val_labs_remove">
+                            <property name="visible">True</property>
+                            <property name="sensitive">False</property>
+                            <property name="can_focus">True</property>
+                            <property name="can_default">True</property>
+                            <property name="label">gtk-remove</property>
+                            <property name="use_stock">True</property>
                           </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
                         </child>
                       </widget>
                       <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>
                         <property name="x_options">GTK_FILL</property>
-                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                     <child>
                         <property name="column_spacing">5</property>
                         <property name="row_spacing">4</property>
                         <child>
-                          <widget class="GtkHBox" id="hbox4">
+                          <widget class="GtkLabel" id="label5">
                             <property name="visible">True</property>
-                            <child>
-                              <widget class="GtkEntry" id="value_entry">
-                                <property name="width_request">85</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </widget>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="padding">1</property>
-                              </packing>
-                            </child>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Value:</property>
                           </widget>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="right_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
-                            <property name="y_options">GTK_FILL</property>
+                            <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkEntry" id="label_entry">
+                          <widget class="GtkLabel" id="label6">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Value Label:</property>
                           </widget>
                           <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>
+                            <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label6">
+                          <widget class="GtkEntry" id="label_entry">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Value Label:</property>
+                            <property name="can_focus">True</property>
                           </widget>
                           <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>
-                            <property name="x_options">GTK_FILL</property>
                             <property name="y_options"></property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label5">
+                          <widget class="GtkHBox" id="hbox4">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Value:</property>
+                            <child>
+                              <widget class="GtkEntry" id="value_entry">
+                                <property name="width_request">85</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="padding">1</property>
+                              </packing>
+                            </child>
                           </widget>
                           <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
                             <property name="x_options">GTK_FILL</property>
-                            <property name="y_options"></property>
+                            <property name="y_options">GTK_FILL</property>
                           </packing>
                         </child>
                       </widget>
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkVButtonBox" id="vbuttonbox2">
+                      <widget class="GtkScrolledWindow" id="scrolledwindow3">
                         <property name="visible">True</property>
-                        <property name="border_width">5</property>
-                        <child>
-                          <widget class="GtkButton" id="val_labs_add">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="can_default">True</property>
-                            <property name="label">gtk-add</property>
-                            <property name="use_stock">True</property>
-                          </widget>
-                        </child>
-                        <child>
-                          <widget class="GtkButton" id="val_labs_change">
-                            <property name="visible">True</property>
-                            <property name="sensitive">False</property>
-                            <property name="can_focus">True</property>
-                            <property name="can_default">True</property>
-                            <property name="label">gtk-apply</property>
-                            <property name="use_stock">True</property>
-                          </widget>
-                          <packing>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
                         <child>
-                          <widget class="GtkButton" id="val_labs_remove">
+                          <widget class="GtkTreeView" id="treeview1">
                             <property name="visible">True</property>
-                            <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
-                            <property name="can_default">True</property>
-                            <property name="label">gtk-remove</property>
-                            <property name="use_stock">True</property>
+                            <property name="headers_visible">False</property>
+                            <property name="enable_search">False</property>
                           </widget>
-                          <packing>
-                            <property name="position">2</property>
-                          </packing>
                         </child>
                       </widget>
                       <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>
                         <property name="x_options">GTK_FILL</property>
+                        <property name="y_options">GTK_FILL</property>
                       </packing>
                     </child>
                   </widget>
         <property name="n_rows">2</property>
         <property name="n_columns">2</property>
         <child>
-          <widget class="GtkVBox" id="vbox7">
+          <widget class="GtkVButtonBox" id="vbuttonbox5">
             <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="spacing">5</property>
+            <property name="layout_style">GTK_BUTTONBOX_START</property>
             <child>
-              <widget class="GtkRadioButton" id="range_missing">
+              <widget class="GtkButton" id="missing_val_ok">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="label" translatable="yes">_Range plus one optional discrete missing value</property>
-                <property name="use_underline">True</property>
-                <property name="focus_on_click">False</property>
-                <property name="draw_indicator">True</property>
-                <property name="group">no_missing</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="missing_val_cancel">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
               </widget>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkVBox" id="vbox8">
+              <widget class="GtkButton" id="help_button_missing_values">
                 <property name="visible">True</property>
-                <property name="spacing">5</property>
-                <child>
-                  <widget class="GtkHBox" id="hbox7">
-                    <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkHBox" id="hbox8">
-                        <property name="visible">True</property>
-                        <child>
-                          <widget class="GtkLabel" id="label11">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_Low:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">mv-low</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="padding">20</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkEntry" id="mv-low">
-                            <property name="width_request">75</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkHBox" id="hbox9">
-                        <property name="visible">True</property>
-                        <child>
-                          <widget class="GtkLabel" id="label12">
-                            <property name="visible">True</property>
-                            <property name="label" translatable="yes">_High:</property>
-                            <property name="use_underline">True</property>
-                            <property name="mnemonic_widget">mv-high</property>
-                          </widget>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <widget class="GtkEntry" id="mv-high">
-                            <property name="width_request">75</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                          </widget>
-                          <packing>
-                            <property name="padding">5</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </widget>
-                      <packing>
-                        <property name="fill">False</property>
-                        <property name="padding">20</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                  </widget>
-                </child>
-                <child>
-                  <widget class="GtkHBox" id="hbox6">
-                    <property name="visible">True</property>
-                    <child>
-                      <widget class="GtkLabel" id="label10">
-                        <property name="visible">True</property>
-                        <property name="label" translatable="yes">Di_screte value:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">mv-discrete</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="padding">20</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkEntry" id="mv-discrete">
-                        <property name="width_request">75</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-help</property>
+                <property name="use_stock">True</property>
               </widget>
               <packing>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </widget>
           <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>
-            <property name="x_options">GTK_FILL</property>
           </packing>
         </child>
         <child>
           </packing>
         </child>
         <child>
-          <widget class="GtkVButtonBox" id="vbuttonbox5">
+          <widget class="GtkVBox" id="vbox7">
             <property name="visible">True</property>
-            <property name="border_width">5</property>
-            <property name="spacing">5</property>
-            <property name="layout_style">GTK_BUTTONBOX_START</property>
-            <child>
-              <widget class="GtkButton" id="missing_val_ok">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-ok</property>
-                <property name="use_stock">True</property>
-              </widget>
-            </child>
             <child>
-              <widget class="GtkButton" id="missing_val_cancel">
+              <widget class="GtkRadioButton" id="range_missing">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-cancel</property>
-                <property name="use_stock">True</property>
+                <property name="label" translatable="yes">_Range plus one optional discrete missing value</property>
+                <property name="use_underline">True</property>
+                <property name="focus_on_click">False</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">no_missing</property>
               </widget>
               <packing>
-                <property name="position">1</property>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkButton" id="help_button_missing_values">
+              <widget class="GtkVBox" id="vbox8">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="label">gtk-help</property>
-                <property name="use_stock">True</property>
+                <property name="spacing">5</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox7">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox8">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label11">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">_Low:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">mv-low</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="padding">20</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkEntry" id="mv-low">
+                            <property name="width_request">75</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox9">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkLabel" id="label12">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">_High:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">mv-high</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkEntry" id="mv-high">
+                            <property name="width_request">75</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </widget>
+                          <packing>
+                            <property name="padding">5</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="fill">False</property>
+                        <property name="padding">20</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkHBox" id="hbox6">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkLabel" id="label10">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Di_screte value:</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">mv-discrete</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">20</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="mv-discrete">
+                        <property name="width_request">75</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </widget>
               <packing>
-                <property name="position">2</property>
+                <property name="position">1</property>
               </packing>
             </child>
           </widget>
           <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>
+            <property name="x_options">GTK_FILL</property>
           </packing>
         </child>
       </widget>
index 079f6d925c65cd1912a7fe7cde3c7ab35675cae5..038eeb2f4c09e0e7faeda5f153519e1936be12b8 100644 (file)
 #include <gtk/gtk.h>
 #include <glade/glade.h>
 
+
+/*
+   GtkRecentChooserMenu was added in 2.10.0
+   but it didn't support GtkRecentFilters until
+   2.10.2
+*/
+#define RECENT_LISTS_AVAILABLE GTK_CHECK_VERSION (2, 10, 2)
+
+
 /* Formats a value according to FORMAT
    The returned string must be freed when no longer required */
 gchar * value_to_text (union value v, struct fmt_spec format);
index 024181e6a910fca42083bb3e9d987b14958ed1c6..fc9a44011dd045223a248e901b0436637d41c628 100644 (file)
@@ -466,7 +466,7 @@ save_editor_to_file (struct syntax_editor *se,
 /*
   Loads the buffer from the file called FILENAME
 */
-static gboolean
+gboolean
 load_editor_from_file (struct syntax_editor *se,
                       const gchar *filename,
                       GError **err)
@@ -492,6 +492,9 @@ load_editor_from_file (struct syntax_editor *se,
 
   gtk_text_buffer_insert (buffer, &iter, text, -1);
 
+
+
+
   window_set_name_from_filename ((struct editor_window *)se, filename);
   gtk_text_buffer_set_modified (buffer, FALSE);
 
@@ -536,6 +539,19 @@ open_syntax_window (GtkMenuItem *menuitem, gpointer parent)
        window_create (WINDOW_SYNTAX, file_name);
 
       load_editor_from_file (se, file_name, NULL);
+
+#if RECENT_LISTS_AVAILABLE
+      {
+       GtkRecentManager *manager = gtk_recent_manager_get_default();
+       gchar *uri = g_filename_to_uri (file_name, NULL, NULL);
+
+       if ( ! gtk_recent_manager_add_item (manager, uri))
+         g_warning ("Could not add item %s to recent list\n",uri);
+
+       g_free (uri);
+      }
+#endif
+
     }
 
   gtk_widget_destroy (dialog);
index 0d366831b988fc817fa41689b71d4d8d732e1a25..7e8a40e2dc1294b7cb3767b74e73c71c6ebe5e00 100644 (file)
@@ -41,5 +41,7 @@ void new_syntax_window (GtkMenuItem *, gpointer);
 
 void open_syntax_window (GtkMenuItem *, gpointer);
 
-
+gboolean load_editor_from_file (struct syntax_editor *se,
+                               const gchar *filename,
+                               GError **err);
 #endif