[dia/utsa/lang] Revert "prefrences: add language selector"



commit 8221cdbeaf21e97ca3ec577fd02c9b7c34165611
Author: Zander Brown <zbrown gnome org>
Date:   Tue May 12 22:03:39 2020 +0100

    Revert "prefrences: add language selector"
    
    This reverts commit 30e60783d8c3ed439f593e1bcec6a15345239f5e.

 app/preferences.c             | 177 +-----------------------------------------
 app/preferences.h             |   3 -
 data/ui/preferences-dialog.ui |  71 -----------------
 3 files changed, 2 insertions(+), 249 deletions(-)
---
diff --git a/app/preferences.c b/app/preferences.c
index 13a6b37e..2487520f 100644
--- a/app/preferences.c
+++ b/app/preferences.c
@@ -65,83 +65,6 @@ struct _DiaPreferencesDialog {
 G_DEFINE_TYPE (DiaPreferencesDialog, dia_preferences_dialog, GTK_TYPE_DIALOG)
 
 
-static const char *langs[] = {
-       "en_US",
-       "am",
-       "ar",
-       "ast",
-       "az",
-       "be",
-       "bg",
-       "bs",
-       "ca",
-       "ca@valencia",
-       "cs",
-       "da",
-       "de",
-       "dz",
-       "el",
-       "en_CA",
-       "en_GB",
-       "eo",
-       "es",
-       "eu",
-       "fa",
-       "fi",
-       "fr",
-       "ga",
-       "gl",
-       "gu",
-       "he",
-       "hr",
-       "hu",
-       "id",
-       "is",
-       "it",
-       "ja",
-       "kk",
-       "kn",
-       "ko",
-       "lt",
-       "lv",
-       "mk",
-       "ml",
-       "mn",
-       "mr",
-       "ms",
-       "nb",
-       "ne",
-       "nl",
-       "nn",
-       "oc",
-       "pa",
-       "pl",
-       "pt",
-       "pt_BR",
-       "ro",
-       "ru",
-       "rw",
-       "sk",
-       "sl",
-       "sq",
-       "sr",
-       "sr@latin",
-       "sv",
-       "th",
-       "tr",
-       "uk",
-       "vi",
-       "zh_CN",
-       "zh_HK",
-       "zh_TW",
-       NULL
-};
-
-static const char * dia_lang_get_name(int i) {
-       return langs[i];
-}
-
-
 static void
 dia_preferences_dialog_response (GtkDialog *dialog, int response)
 {
@@ -356,26 +279,6 @@ dd_type_changed (GtkComboBox *combo,
   }
 }
 
-static void
-lang_changed (GtkComboBox *combo,
-                 gpointer     data)
-{
-  GtkTreeIter iter;
-  GtkTreeModel *model;
-  char *lang;
-
-  model = gtk_combo_box_get_model (combo);
-
-  if (gtk_combo_box_get_active_iter (combo, &iter)) {
-    gtk_tree_model_get (model, &iter, COL_NAME, &lang, -1);
-
-    g_clear_pointer (&prefs.lang.lang, g_free);
-    prefs.lang.lang = lang;
-
-    persistence_set_string ("lang_lang", lang);
-  }
-}
-
 
 static void
 dd_background_changed (DiaColorSelector *selector,
@@ -445,41 +348,6 @@ set_current_paper (GtkTreeModel *model,
 }
 
 
-
-struct SetCurrentLang {
-  const char *to_set;
-  GtkWidget  *combo;
-};
-
-
-static gboolean
-set_current_lang (GtkTreeModel *model,
-                   GtkTreePath  *path,
-                   GtkTreeIter  *iter,
-                   gpointer      data)
-{
-  struct SetCurrentLang *find = data;
-  char *lang;
-
-  gtk_tree_model_get (model, iter, COL_NAME, &lang, -1);
-  GtkComboBox *baby = GTK_COMBO_BOX (find->combo);
-  if (g_strcmp0 (lang, find->to_set) == 0) {
-    gtk_combo_box_set_active_iter (baby, iter);
-
-    g_clear_pointer (&lang, g_free);
-
-    return TRUE;
-  }
-
-  g_clear_pointer (&lang, g_free);
-
-  return FALSE;
-}
-
-
-
-
-
 static void
 vd_width_value_changed (GtkSpinButton *spin,
                         gpointer       data)
@@ -841,7 +709,6 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
   struct SetCurrentUnit find_unit;
   struct SetCurrentPaper find_paper;
   struct SetCurrentFilter find_filter;
-  struct SetCurrentLang find_lang;
   GtkWidget *dialog_vbox;
   DiaBuilder *builder;
   GtkWidget *content;
@@ -852,7 +719,6 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
   GtkListStore *pss;
   GtkListStore *wmfs;
   GtkListStore *emfs;
-  GtkListStore *langStore;
   GtkWidget *ui_reset_tools;
   GtkAdjustment *ui_undo_spin_adj;
   GtkWidget *ui_reverse_drag;
@@ -892,9 +758,9 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
   GtkAdjustment *gl_man_cvs_adj;
   GtkAdjustment *gl_man_rvs_adj;
   GtkAdjustment *gl_hex_size_adj;
-  GtkWidget *cbLanguages;
   int j = 0;
   const char *name;
+
   gtk_dialog_add_buttons (GTK_DIALOG (self),
                           _("_Done"), GTK_RESPONSE_OK,
                           NULL);
@@ -965,11 +831,8 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
                    "gl_hex", &self->gl_hex,
                    "gl_hex_size", &self->gl_hex_size,
                    "gl_hex_size_adj", &gl_hex_size_adj,
-                                  "cbLanguages", &cbLanguages,
-                                  "langStore", &langStore,
                    NULL);
-  GtkComboBox *baby = GTK_COMBO_BOX (cbLanguages);
-  GtkTreeModel *baby2 = GTK_TREE_MODEL(langStore);
+
   for (DiaUnit unit = 0; unit < DIA_LAST_UNIT; unit++) {
     GtkTreeIter iter;
 
@@ -992,22 +855,6 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
     j++;
   }
 
-  j = 0;
-  while ((name = dia_lang_get_name (j))) {
-    GtkTreeIter iter;
-
-    gtk_list_store_append (langStore, &iter);
-    gtk_list_store_set (langStore, &iter,
-                        COL_NAME, name,
-                        COL_UNIT, j,
-                        -1);
-
-    j++;
-  }
-
-
-
-
   fill_exporter_list (pngs, "PNG");
   fill_exporter_list (svgs, "SVG");
   fill_exporter_list (pss, "PS");
@@ -1041,14 +888,6 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
   gtk_tree_model_foreach (GTK_TREE_MODEL (paper),
                           set_current_paper,
                           &find_paper);
-
-  find_lang.combo = cbLanguages;
-  find_lang.to_set = prefs.lang.lang;
-  gtk_tree_model_foreach (GTK_TREE_MODEL (langStore),
-                          set_current_lang,
-                          &find_lang);
-
-
   dia_color_selector_set_color (dd_background, &prefs.new_diagram.bg_color);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dd_compress),
                                 prefs.new_diagram.compress_save);
@@ -1130,7 +969,6 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
 
   dia_builder_connect (builder,
                        self,
-                                          "lang_changed", G_CALLBACK (lang_changed),
                        /* User Interface */
                        "ui_reset_tools_toggled", G_CALLBACK (ui_reset_tools_toggled),
                        "ui_undo_spin_changed", G_CALLBACK (ui_undo_spin_changed),
@@ -1176,7 +1014,6 @@ dia_preferences_dialog_init (DiaPreferencesDialog *self)
                        "gl_man_rvs_value_changed", G_CALLBACK (gl_man_rvs_value_changed),
                        "gl_hex_size_value_changed", G_CALLBACK (gl_hex_size_value_changed),
                        "gl_update_sensitive", G_CALLBACK (gl_update_sensitive),
-                                          /* Languages */
                        NULL);
 
   gtk_container_add (GTK_CONTAINER (dialog_vbox), content);
@@ -1259,14 +1096,4 @@ dia_preferences_init (void)
   prefs.grid.vis_y = persistence_register_real ("grid_vis_y", 1);
   prefs.grid.hex = persistence_register_boolean ("grid_hex", FALSE);
   prefs.grid.hex_size = persistence_register_real ("grid_hex_size", 1);
-
-  prefs.lang.lang = persistence_register_string ("lang_lang", dia_lang_get_name(0));
-  char* val = getenv ("LANG");
-  if (val == NULL || strcmp(val, prefs.lang.lang) != 0) {
-         #ifdef G_OS_WIN32
-         _putenv_s("LANG", prefs.lang.lang);
-         #else
-         setenv("LANG", prefs.lang.lang);
-         #endif
-  }
 }
diff --git a/app/preferences.h b/app/preferences.h
index 8b13e685..d7bae005 100644
--- a/app/preferences.h
+++ b/app/preferences.h
@@ -79,9 +79,6 @@ struct DiaPreferences {
   int guides_visible;   /** Whether guides are visible. */
   int guides_snap;      /** Whether to snap to guides. */
   guint snap_distance;  /** The snapping distance for guides. */
-  struct {
-         char *lang;
-  } lang;
 };
 
 extern struct DiaPreferences prefs;
diff --git a/data/ui/preferences-dialog.ui b/data/ui/preferences-dialog.ui
index 6d425cf2..d9825035 100644
--- a/data/ui/preferences-dialog.ui
+++ b/data/ui/preferences-dialog.ui
@@ -46,14 +46,6 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
-  <object class="GtkListStore" id="langStore">
-    <columns>
-      <!-- column-name name -->
-      <column type="gchararray"/>
-      <!-- column-name language -->
-      <column type="gint"/>
-    </columns>
-  </object>
   <object class="GtkListStore" id="paper">
     <columns>
       <!-- column-name name -->
@@ -1594,69 +1586,6 @@
         <property name="tab_fill">False</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkVBox" id="vbox8">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <child>
-          <object class="GtkTable" id="table7">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="n_columns">2</property>
-            <child>
-              <object class="GtkLabel" id="label7">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Languages</property>
-              </object>
-              <packing>
-                <property name="y_options">GTK_EXPAND</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkComboBox" id="cbLanguages">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="model">langStore</property>
-                <signal name="changed" handler="lang_changed" swapped="no"/>
-                <child>
-                  <object class="GtkCellRendererText" id="cellrenderertext9"/>
-                  <attributes>
-                    <attribute name="text">0</attribute>
-                  </attributes>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <placeholder/>
-        </child>
-      </object>
-      <packing>
-        <property name="position">5</property>
-      </packing>
-    </child>
-    <child type="tab">
-      <object class="GtkLabel" id="label6">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">Languages</property>
-      </object>
-      <packing>
-        <property name="position">5</property>
-        <property name="tab_fill">False</property>
-      </packing>
-    </child>
   </object>
   <object class="GtkSizeGroup" id="sizegroup1">
     <property name="mode">both</property>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]