[gtranslator/gtk4: 15/52] fixed gtr-dl-teams except load functionality and filter-selection.ui except searching from entry




commit ef58ba86b1ef517b2b6938ae768c5d7120303f42
Author: afshan ahmed khan <afshanahmeda2k gmail com>
Date:   Wed Jun 8 14:32:12 2022 +0530

    fixed gtr-dl-teams except load functionality and filter-selection.ui except searching from entry

 src/gtr-dl-teams.c               |   3 -
 src/gtr-filter-selection-new.c   | 276 +++++++++++++++++++++++++++++++++++++++
 src/gtr-filter-selection-old.ui  |   2 +-
 src/gtr-filter-selection.c       |  53 ++++----
 src/gtr-filter-selection.ui      |   1 +
 src/gtr-lang-button.c            |   1 +
 src/gtr-languages-fetcher-old.ui | 228 ++++++++++++++++++++++++++++++++
 src/gtr-languages-fetcher.c      |  11 +-
 src/gtr-languages-fetcher.ui     | 214 +++++++++++++-----------------
 src/gtr-profile-dialog.c         |   3 +-
 src/gtr-profile-dialog.ui        |  29 ++--
 11 files changed, 647 insertions(+), 174 deletions(-)
---
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index 466903dd..628d128f 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -843,7 +843,6 @@ gtr_dl_teams_class_init (GtrDlTeamsClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, instructions);
 
   gtk_widget_class_bind_template_child_private (widget_class, GtrDlTeams, open_button);
-
 }
 
 static void
@@ -887,12 +886,10 @@ gtr_dl_teams_init (GtrDlTeams *self)
   priv->domains_combobox = gtk_combo_box_text_new ();
   gtk_widget_set_name (priv->domains_combobox, "combo_domains");
   gtk_box_append (GTK_BOX (priv->select_box), priv->domains_combobox);
-  gtk_widget_hide (priv->domains_combobox);
 
   priv->branches_combobox = gtk_combo_box_text_new ();
   gtk_widget_set_name (priv->branches_combobox, "combo_branches");
   gtk_box_append (GTK_BOX (priv->select_box), priv->branches_combobox);
-  gtk_widget_hide (priv->branches_combobox);
 
   /* Load teams and modules automatically */
   gtr_dl_teams_load_json (self);
diff --git a/src/gtr-filter-selection-new.c b/src/gtr-filter-selection-new.c
new file mode 100644
index 00000000..8c0a1852
--- /dev/null
+++ b/src/gtr-filter-selection-new.c
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2019  Daniel Garcia Moreno <danigm gnome org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "gtr-filter-selection.h"
+#include "gtr-utils.h"
+
+typedef struct
+{
+  GtkWidget *entry;
+  GtkWidget *option_list;
+  GtkWidget *popup;
+  GSList *options;
+  // TODO: manage this as a property
+  GtrFilterOption *option;
+
+} GtrFilterSelectionPrivate;
+
+enum
+{
+  CHANGED,
+  LAST_SIGNAL
+};
+
+G_DEFINE_TYPE_WITH_PRIVATE (GtrFilterSelection, gtr_filter_selection, GTK_TYPE_MENU_BUTTON)
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static void
+change_option (GtkListBox         *box,
+               GtkListBoxRow      *row,
+               GtrFilterSelection *self)
+{
+  GSList *o = NULL;
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  GtkWidget *label = gtk_bin_get_child (GTK_BIN (row));
+  const char *label_text = gtk_label_get_text (GTK_LABEL (label));
+
+  for (o = priv->options; o != NULL; o = g_slist_next (o))
+    {
+      GtrFilterOption *opt = (GtrFilterOption *)o->data;
+      if (!g_strcmp0 (opt->desc, label_text))
+        {
+          gtr_filter_selection_set_option_full (self, opt);
+          break;
+        }
+    }
+
+  gtk_popover_popdown (GTK_POPOVER (priv->popup));
+}
+
+static void
+filter_option (GtkEditable        *entry,
+               GtrFilterSelection *self)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  const char *text = gtk_entry_get_text (GTK_ENTRY (entry));
+  g_autofree char *uptext = g_ascii_strup (text, -1);
+  const GSList *o;
+  GList *children;
+
+  children = gtk_container_get_children (GTK_CONTAINER (priv->option_list));
+  while (children)
+    {
+      GtkWidget *w = GTK_WIDGET (children->data);
+      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), w);
+      children = g_list_next (children);
+    }
+
+  for (o = priv->options; o != NULL; o = g_slist_next (o))
+    {
+      GtkWidget *child;
+      GtrFilterOption *opt = (GtrFilterOption *)o->data;
+      g_autofree char *upopt = g_ascii_strup (opt->desc, -1);
+
+      if (g_strrstr (upopt, uptext) == NULL)
+        continue;
+
+      child = gtk_label_new (opt->desc);
+      gtk_label_set_xalign (GTK_LABEL (child), 0.0);
+      gtk_list_box_append (GTK_LIST_BOX (priv->option_list), child);
+    }
+  gtk_widget_show_all (priv->option_list);
+}
+
+static void
+gtr_filter_selection_finalize (GObject *object)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (GTR_FILTER_SELECTION 
(object));
+  if (priv->options)
+    g_slist_free_full (priv->options, (GDestroyNotify)gtr_filter_option_free);
+  G_OBJECT_CLASS (gtr_filter_selection_parent_class)->finalize (object);
+}
+
+static void
+gtr_filter_selection_class_init (GtrFilterSelectionClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = gtr_filter_selection_finalize;
+
+  signals[CHANGED] =
+    g_signal_newv ("changed",
+                   G_OBJECT_CLASS_TYPE (object_class),
+                   G_SIGNAL_RUN_LAST,
+                   NULL, NULL, NULL, NULL,
+                   G_TYPE_NONE, 0, NULL);
+
+  gtk_widget_class_set_template_from_resource (widget_class,
+                                               "/org/gnome/translator/gtr-filter-selection.ui");
+
+  gtk_widget_class_bind_template_child_private (widget_class, GtrFilterSelection, entry);
+  gtk_widget_class_bind_template_child_private (widget_class, GtrFilterSelection, option_list);
+  gtk_widget_class_bind_template_child_private (widget_class, GtrFilterSelection, popup);
+}
+
+static void
+gtr_filter_selection_init (GtrFilterSelection *self)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  priv->option = NULL;
+  priv->options = NULL;
+  gtk_widget_init_template (GTK_WIDGET (self));
+  gtk_widget_show_all (priv->option_list);
+
+  g_signal_connect (priv->option_list,
+                    "row-activated",
+                    G_CALLBACK (change_option),
+                    self);
+
+  g_signal_connect (priv->entry,
+                    "changed",
+                    G_CALLBACK (filter_option),
+                    self);
+}
+
+GtrFilterSelection*
+gtr_filter_selection_new () {
+  GtrFilterSelection *self = g_object_new (GTR_TYPE_FILTER_SELECTION, NULL);
+  return self;
+}
+
+const GtrFilterOption *
+gtr_filter_selection_get_option (GtrFilterSelection *self)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  return priv->option;
+}
+
+void
+gtr_filter_selection_set_option (GtrFilterSelection *self,
+                                 const char         *name)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  GSList *o = NULL;
+
+  for (o = priv->options; o != NULL; o = g_slist_next (o))
+    {
+      GtrFilterOption *opt = (GtrFilterOption *)o->data;
+      if (!g_strcmp0 (opt->name, name) || !g_strcmp0 (opt->desc, name))
+        {
+          gtr_filter_selection_set_option_full (self, opt);
+          break;
+        }
+    }
+}
+
+void
+gtr_filter_selection_set_option_full (GtrFilterSelection *self,
+                                      GtrFilterOption   *option)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  priv->option = option;
+  gtk_button_set_label (GTK_BUTTON (self), option->desc);
+  g_signal_emit (self, signals[CHANGED], 0, NULL);
+}
+
+void
+gtr_filter_selection_set_options_full (GtrFilterSelection *self,
+                                       GSList *options)
+{
+  GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (self);
+  const GSList *o;
+  GList *children;
+
+  if (priv->options)
+    g_slist_free_full (priv->options, (GDestroyNotify)gtr_filter_option_free);
+  priv->options = options;
+
+  children = gtk_container_get_children (GTK_CONTAINER (priv->option_list));
+  while (children)
+    {
+      GtkWidget *w = GTK_WIDGET (children->data);
+      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), w);
+      children = g_list_next (children);
+    }
+
+  for (o = priv->options; o != NULL; o = g_slist_next (o))
+    {
+      GtrFilterOption *opt = (GtrFilterOption *)o->data;
+      GtkWidget *child = gtk_label_new (opt->desc);
+      gtk_label_set_xalign (GTK_LABEL (child), 0.0);
+      gtk_list_box_append (GTK_LIST_BOX (priv->option_list), child);
+    }
+
+  gtk_widget_show_all (priv->option_list);
+}
+
+void
+gtr_filter_selection_set_options (GtrFilterSelection *self,
+                                  const GSList *options)
+{
+  const GSList *o;
+  GSList *optlist = NULL;
+
+  for (o = options; o != NULL; o = g_slist_next (o))
+    {
+      const char *opt = (char *)o->data;
+      GtrFilterOption *option = gtr_filter_option_new (opt, opt);
+      optlist = g_slist_append (optlist, option);
+    }
+
+  gtr_filter_selection_set_options_full (self, optlist);
+}
+
+void
+gtr_filter_selection_set_text (GtrFilterSelection *selection,
+                               const char *text)
+{
+  gtk_button_set_label (GTK_BUTTON (selection), text);
+}
+
+void
+gtr_filter_option_free (GtrFilterOption *opt)
+{
+  if (!opt)
+    return;
+
+  if (opt->name)
+    g_free (opt->name);
+  if (opt->desc)
+    g_free (opt->desc);
+  g_free (opt);
+}
+
+GtrFilterOption *
+gtr_filter_option_new (const gchar *name,
+                       const gchar *desc)
+{
+  GtrFilterOption *option = g_malloc0 (sizeof (GtrFilterOption));
+  if (name)
+    option->name = g_strdup (name);
+  if (desc)
+    option->desc = g_strdup (desc);
+  return option;
+}
+
diff --git a/src/gtr-filter-selection-old.ui b/src/gtr-filter-selection-old.ui
index 1dff66d7..46fe055f 100644
--- a/src/gtr-filter-selection-old.ui
+++ b/src/gtr-filter-selection-old.ui
@@ -57,7 +57,7 @@
       </object>
     </child>
   </object>
-  <template class="GtrFilterSelection" parent="GtkButton" >
+  <template class="GtrFilterSelection" parent="GtkPopoverMenu" >
     <property name="label" translatable="no">Choose Option</property>
     <property name="visible">True</property>
     <property name="can_focus">False</property>
diff --git a/src/gtr-filter-selection.c b/src/gtr-filter-selection.c
index 657aa2fa..a8f204c8 100644
--- a/src/gtr-filter-selection.c
+++ b/src/gtr-filter-selection.c
@@ -85,22 +85,21 @@ filter_option (GtkEditable        *entry,
   g_autofree char *uptext = g_ascii_strup (text, -1);
   const GSList *o;
   GtkWidget *children;
-
-  /* children = gtk_container_get_children (GTK_CONTAINER (priv->option_list));
-  while (children)
-    {
-      GtkWidget *w = GTK_WIDGET (children->data);
-      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), w);
-      children = g_list_next (children);
-    } */
-
-  children = gtk_widget_get_first_child (GTK_WIDGET (priv->option_list));
-  while (children)
-    {
-      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), children);
-      children = gtk_widget_get_next_sibling (children);
-    }
-
+  GtkWidget *row;
+
+  int i = 0 ;
+  //g_printf("%d and %d\n",i,g_slist_length(priv->options) );
+  while (row = gtk_list_box_get_row_at_index (GTK_LIST_BOX(priv->option_list),i))
+  {
+    gtk_list_box_remove(GTK_LIST_BOX(priv->option_list), row);
+    i++;
+  }
+  //g_printf("%d and %d\n",i,g_slist_length(priv->options) );
+  if(row == NULL)
+    //g_printf("all removed\n");
+
+  gtk_widget_show(priv->option_list);
+  //g_printf("UPTEXT - %s\n",uptext);
   for (o = priv->options; o != NULL; o = g_slist_next (o))
     {
       GtkWidget *child;
@@ -110,10 +109,13 @@ filter_option (GtkEditable        *entry,
       if (g_strrstr (upopt, uptext) == NULL)
         continue;
 
+      //g_printf("%s\n",opt->desc);
+
       child = gtk_label_new (opt->desc);
       gtk_label_set_xalign (GTK_LABEL (child), 0.0);
-      gtk_list_box_append (GTK_LIST_BOX (priv->option_list), child);
+      //gtk_list_box_append (GTK_LIST_BOX (priv->option_list), child);
     }
+  //g_printf("\n\n\n");
   gtk_widget_show (priv->option_list);
 }
 
@@ -123,6 +125,7 @@ gtr_filter_selection_finalize (GObject *object)
   GtrFilterSelectionPrivate *priv = gtr_filter_selection_get_instance_private (GTR_FILTER_SELECTION 
(object));
   if (priv->options)
     g_slist_free_full (priv->options, (GDestroyNotify)gtr_filter_option_free);
+  //g_printf("finalized\n");
   G_OBJECT_CLASS (gtr_filter_selection_parent_class)->finalize (object);
 }
 
@@ -149,6 +152,7 @@ gtr_filter_selection_class_init (GtrFilterSelectionClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtrFilterSelection, popup);
 }
 
+
 static void
 gtr_filter_selection_init (GtrFilterSelection *self)
 {
@@ -157,7 +161,7 @@ gtr_filter_selection_init (GtrFilterSelection *self)
   priv->options = NULL;
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  gtk_popover_set_default_widget (GTK_POPOVER(priv->popup),GTK_WIDGET(self));
+  gtk_widget_set_parent (priv->popup, GTK_WIDGET(self));
   g_signal_connect (self,
                     "clicked",
                     G_CALLBACK(handle_filter_selection_btn_clicked),
@@ -229,6 +233,7 @@ gtr_filter_selection_set_options_full (GtrFilterSelection *self,
   priv->options = options;
 
   GtkWidget *children;
+  GtkWidget *row;
   /* children = gtk_container_get_children (GTK_CONTAINER (priv->option_list));
   while (children)
     {
@@ -237,12 +242,12 @@ gtr_filter_selection_set_options_full (GtrFilterSelection *self,
       children = g_list_next (children);
     } */
 
-  children = gtk_widget_get_first_child (GTK_WIDGET (priv->option_list));
-  while (children)
-    {
-      gtk_list_box_remove (GTK_LIST_BOX (priv->option_list), GTK_WIDGET(children));
-      children = gtk_widget_get_next_sibling (children);
-    }
+  int i = 0 ;
+  while (row = gtk_list_box_get_row_at_index (GTK_LIST_BOX(priv->option_list),i))
+  {
+    gtk_list_box_remove(GTK_LIST_BOX(priv->option_list), row);
+    i++;
+  }
 
   for (o = priv->options; o != NULL; o = g_slist_next (o))
     {
diff --git a/src/gtr-filter-selection.ui b/src/gtr-filter-selection.ui
index 15faf2c3..cf8b61ae 100644
--- a/src/gtr-filter-selection.ui
+++ b/src/gtr-filter-selection.ui
@@ -21,6 +21,7 @@
             <property name="height_request">200</property>
             <property name="focusable">1</property>
             <property name="vexpand">1</property>
+            <property name="has_frame">1</property>
             <property name="child">
               <object class="GtkViewport">
                 <property name="child">
diff --git a/src/gtr-lang-button.c b/src/gtr-lang-button.c
index 7f7c3993..c25b9aa8 100644
--- a/src/gtr-lang-button.c
+++ b/src/gtr-lang-button.c
@@ -66,6 +66,7 @@ gtr_lang_button_init (GtrLangButton *self)
 
   if (langs)
     g_slist_free_full (langs, g_free);
+  g_printf("ran init of lang button\n");
 }
 
 GtrLangButton*
diff --git a/src/gtr-languages-fetcher-old.ui b/src/gtr-languages-fetcher-old.ui
new file mode 100644
index 00000000..d8067ab4
--- /dev/null
+++ b/src/gtr-languages-fetcher-old.ui
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+  <requires lib="gtk+" version="3.0"/>
+  <object class="GtkListStore" id="code_store">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name language -->
+      <column type="gpointer"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="language_store">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name language -->
+      <column type="gpointer"/>
+    </columns>
+  </object>
+  <object class="GtkWindow" id="languages-fetcher">
+    <property name="can_focus">False</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <object class="GtkBox" id="main_box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="margin_start">6</property>
+        <property name="margin_end">6</property>
+        <property name="margin_top">6</property>
+        <property name="margin_bottom">6</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkGrid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="row_spacing">4</property>
+            <property name="column_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label11">
+                <property name="width_request">80</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</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">_Language</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label12">
+                <property name="visible">True</property>
+                <property name="can_focus">False</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">Language _code</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label13">
+                <property name="visible">True</property>
+                <property name="can_focus">False</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">Character _set</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label14">
+                <property name="visible">True</property>
+                <property name="can_focus">False</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">Transfer en_coding</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label10">
+                <property name="visible">True</property>
+                <property name="can_focus">False</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">_Plural forms</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="language_code">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">False</property>
+                <property name="model">code_store</property>
+                <property name="has_entry">True</property>
+                <property name="entry_text_column">0</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="charset">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">False</property>
+                <property name="has_entry">True</property>
+                <items>
+                  <item>UTF-8</item>
+                </items>
+                <child internal-child="entry">
+                  <object class="GtkEntry">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="encoding">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">False</property>
+                <property name="has_entry">True</property>
+                <items>
+                  <item>8bit</item>
+                </items>
+                <child internal-child="entry">
+                  <object class="GtkEntry">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="plural_forms">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">False</property>
+                <property name="has_entry">True</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtrLangButton" id="language">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="advanced_check">
+                <property name="label" translatable="yes">_Edit options manually</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="draw_indicator">True</property>
+               <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/src/gtr-languages-fetcher.c b/src/gtr-languages-fetcher.c
index c63def9e..7f697eb4 100644
--- a/src/gtr-languages-fetcher.c
+++ b/src/gtr-languages-fetcher.c
@@ -347,6 +347,7 @@ gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
 {
   GtkWidget *content;
   GtkBuilder *builder;
+  GError *error = NULL;
   gchar *root_objects[] = {
     "main_box",
     "code_store",
@@ -361,7 +362,11 @@ gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
 
   builder = gtk_builder_new ();
   gtk_builder_add_objects_from_resource (builder, "/org/gnome/translator/gtr-languages-fetcher.ui",
-                                         root_objects, NULL);
+                                         root_objects, &error);
+  if (error)
+  {
+    g_printf("%s \n", error->message);
+  }
 
   content = GTK_WIDGET (gtk_builder_get_object (builder, "main_box"));
   g_object_ref (content);
@@ -388,10 +393,10 @@ gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
                     "activate",
                     G_CALLBACK (on_language_code_activate),
                     fetcher);
-  g_signal_connect (GTK_ENTRY (gtk_combo_box_get_child(GTK_COMBO_BOX (priv->language_code))),
+  /*g_signal_connect (GTK_ENTRY (gtk_combo_box_get_child(GTK_COMBO_BOX (priv->language_code))),
                     "focus-out-event",
                     G_CALLBACK (on_language_code_focus_out_event),
-                    fetcher);
+                    fetcher);*/
 
   /* To emit the changed signal */
   g_signal_connect (priv->language, "changed",
diff --git a/src/gtr-languages-fetcher.ui b/src/gtr-languages-fetcher.ui
index d8067ab4..2d322974 100644
--- a/src/gtr-languages-fetcher.ui
+++ b/src/gtr-languages-fetcher.ui
@@ -1,33 +1,25 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
 <interface>
-  <requires lib="gtk+" version="3.0"/>
+  <requires lib="gtk" version="4.0"/>
   <object class="GtkListStore" id="code_store">
     <columns>
-      <!-- column-name text -->
       <column type="gchararray"/>
-      <!-- column-name language -->
       <column type="gpointer"/>
     </columns>
   </object>
   <object class="GtkListStore" id="language_store">
     <columns>
-      <!-- column-name text -->
       <column type="gchararray"/>
-      <!-- column-name language -->
       <column type="gpointer"/>
     </columns>
   </object>
   <object class="GtkWindow" id="languages-fetcher">
-    <property name="can_focus">False</property>
     <child>
       <placeholder/>
     </child>
-    <child>
+    <property name="child">
       <object class="GtkBox" id="main_box">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <!--<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>-->
         <property name="margin_start">6</property>
         <property name="margin_end">6</property>
         <property name="margin_top">6</property>
@@ -36,193 +28,167 @@
         <property name="spacing">6</property>
         <child>
           <object class="GtkGrid">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
             <property name="row_spacing">4</property>
             <property name="column_spacing">6</property>
             <child>
               <object class="GtkLabel" id="label11">
                 <property name="width_request">80</property>
-                <property name="visible">True</property>
-                <property name="can_focus">False</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">_Language</property>
-                <property name="use_underline">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="1">_Language</property>
+                <property name="use_underline">1</property>
                 <property name="xalign">1</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">0</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="label12">
-                <property name="visible">True</property>
-                <property name="can_focus">False</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">Language _code</property>
-                <property name="use_underline">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="1">Language _code</property>
+                <property name="use_underline">1</property>
                 <property name="xalign">1</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">2</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="label13">
-                <property name="visible">True</property>
-                <property name="can_focus">False</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">Character _set</property>
-                <property name="use_underline">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="1">Character _set</property>
+                <property name="use_underline">1</property>
                 <property name="xalign">1</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">3</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">3</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="label14">
-                <property name="visible">True</property>
-                <property name="can_focus">False</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">Transfer en_coding</property>
-                <property name="use_underline">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="1">Transfer en_coding</property>
+                <property name="use_underline">1</property>
                 <property name="xalign">1</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">4</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">4</property>
-              </packing>
             </child>
             <child>
               <object class="GtkLabel" id="label10">
-                <property name="visible">True</property>
-                <property name="can_focus">False</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">_Plural forms</property>
-                <property name="use_underline">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="1">_Plural forms</property>
+                <property name="use_underline">1</property>
                 <property name="xalign">1</property>
+                <layout>
+                  <property name="column">0</property>
+                  <property name="row">5</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">5</property>
-              </packing>
             </child>
             <child>
               <object class="GtkComboBox" id="language_code">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">False</property>
+                <property name="sensitive">0</property>
                 <property name="model">code_store</property>
-                <property name="has_entry">True</property>
+                <property name="has_entry">1</property>
                 <property name="entry_text_column">0</property>
-                <child internal-child="entry">
+                <property name="child">
                   <object class="GtkEntry">
-                    <property name="can_focus">True</property>
+                    <property name="visible">0</property>
+                    <property name="focusable">1</property>
                   </object>
-                </child>
+                </property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">2</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-              </packing>
             </child>
             <child>
               <object class="GtkComboBoxText" id="charset">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">False</property>
-                <property name="has_entry">True</property>
+                <property name="sensitive">0</property>
+                <property name="has_entry">1</property>
                 <items>
                   <item>UTF-8</item>
                 </items>
-                <child internal-child="entry">
+                <property name="child">
                   <object class="GtkEntry">
-                    <property name="can_focus">True</property>
+                    <property name="visible">0</property>
+                    <property name="focusable">1</property>
                   </object>
-                </child>
+                </property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">3</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
-              </packing>
             </child>
             <child>
               <object class="GtkComboBoxText" id="encoding">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">False</property>
-                <property name="has_entry">True</property>
+                <property name="sensitive">0</property>
+                <property name="has_entry">1</property>
                 <items>
                   <item>8bit</item>
                 </items>
-                <child internal-child="entry">
+                <property name="child">
                   <object class="GtkEntry">
-                    <property name="can_focus">True</property>
+                    <property name="visible">0</property>
+                    <property name="focusable">1</property>
                   </object>
-                </child>
+                </property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">4</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">4</property>
-              </packing>
             </child>
             <child>
               <object class="GtkComboBoxText" id="plural_forms">
-                <property name="visible">True</property>
-                <property name="sensitive">False</property>
-                <property name="can_focus">False</property>
-                <property name="has_entry">True</property>
-                <child internal-child="entry">
+                <property name="sensitive">0</property>
+                <property name="has_entry">1</property>
+                <property name="child">
                   <object class="GtkEntry">
-                    <property name="can_focus">True</property>
+                    <property name="visible">0</property>
+                    <property name="focusable">1</property>
                   </object>
-                </child>
+                </property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">5</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">5</property>
-              </packing>
             </child>
             <child>
               <object class="GtrLangButton" id="language">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">0</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkCheckButton" id="advanced_check">
-                <property name="label" translatable="yes">_Edit options manually</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="draw_indicator">True</property>
-               <property name="use_underline">True</property>
+                <property name="label" translatable="1">_Edit options manually</property>
+                <property name="focusable">1</property>
+                <property name="use_underline">1</property>
+                <layout>
+                  <property name="column">1</property>
+                  <property name="row">1</property>
+                </layout>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
             </child>
             <child>
               <placeholder/>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">3</property>
-          </packing>
         </child>
       </object>
-    </child>
+    </property>
   </object>
 </interface>
diff --git a/src/gtr-profile-dialog.c b/src/gtr-profile-dialog.c
index 7007dfe9..37b5128c 100644
--- a/src/gtr-profile-dialog.c
+++ b/src/gtr-profile-dialog.c
@@ -176,8 +176,7 @@ gtr_profile_dialog_new (GtkWidget  *parent,
 {
   GtrProfileDialog *dlg;
 
-  dlg = g_object_new (GTR_TYPE_PROFILE_DIALOG, NULL);
-  g_printf("object creation successful\n");
+  dlg = g_object_new (GTR_TYPE_PROFILE_DIALOG,"use-header-bar",TRUE, NULL);
 
   if (profile != NULL)
     {
diff --git a/src/gtr-profile-dialog.ui b/src/gtr-profile-dialog.ui
index 8ec47911..e9deb338 100644
--- a/src/gtr-profile-dialog.ui
+++ b/src/gtr-profile-dialog.ui
@@ -49,7 +49,6 @@
                     </child>
                     <child>
                       <object class="GtkEntry" id="profile_name">
-                        <property name="focusable">1</property>
                         <!--<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>-->
                         <property name="hexpand">1</property>
                         <property name="invisible_char">●</property>
@@ -143,7 +142,6 @@
                     </child>
                     <child>
                       <object class="GtkEntry" id="name">
-                        <property name="focusable">1</property>
                         <!--<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>-->
                         <property name="hexpand">1</property>
                         <property name="invisible_char">●</property>
@@ -155,7 +153,6 @@
                     </child>
                     <child>
                       <object class="GtkEntry" id="email">
-                        <property name="focusable">1</property>
                         <!--<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>-->
                         <property name="invisible_char">●</property>
                         <layout>
@@ -166,7 +163,6 @@
                     </child>
                     <child>
                       <object class="GtkEntry" id="auth_token">
-                        <property name="focusable">1</property>
                         <!--<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>-->
                         <property name="invisible_char">●</property>
                         <layout>
@@ -177,7 +173,6 @@
                     </child>
                     <child>
                       <object class="GtkEntry" id="team_email">
-                        <property name="focusable">1</property>
                         <layout>
                           <property name="column">1</property>
                           <property name="row">5</property>
@@ -207,18 +202,18 @@
                         <layout>
                           <property name="column">0</property>
                           <property name="row">8</property>
-                        <property name="column-span">2</property>
-                      </layout>
-                    </object>
-                  </child>
-                </object>
-              </child>
-            </object>
-          </child>
-        </object>
-      </child>
-    </object>
-  </child>
+                          <property name="column-span">2</property>
+                        </layout>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
   <child internal-child="action_area">
     <object class="GtkBox" id="dialog-action_area1">
       <property name="visible">True</property>


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