[gtranslator: 1/2] The gtr_application_init should not use GTK+ functions. I moved css loader and load_accels() at gtr_



commit 684a862c60bf70c00fcc34ed02c545dfe449c2e6
Author: Izabela Bakollari <izabela bakollari gmail com>
Date:   Wed Nov 6 08:03:42 2019 +0000

    The gtr_application_init should not use GTK+ functions. I moved css loader and load_accels() at 
gtr_application_startup where gtk_init is called. This commit tries to solve the critical at start 
"gtk_icon_theme_get_for_screen: assertion 'GDK_IS_SCREEN (screen)' failed"

 src/gtr-application.c |  1 +
 src/gtr-notebook.c    | 11 +++++++++++
 src/gtr-notebook.h    |  2 ++
 src/gtr-window.c      |  8 ++++++++
 src/gtr-window.h      |  2 ++
 src/help-overlay.ui   |  7 +++++++
 6 files changed, 31 insertions(+)
---
diff --git a/src/gtr-application.c b/src/gtr-application.c
index 2ea21f0b..4ad84cf8 100644
--- a/src/gtr-application.c
+++ b/src/gtr-application.c
@@ -524,6 +524,7 @@ sort_by_activated (GSimpleAction *action,
   tab = gtr_window_get_active_tab (w);
   g_return_if_fail (tab != NULL);
   gtr_tab_sort_by (tab, (GtrMessageTableSortBy)sortby);
+  gtr_window_hide_sort_menu (w);
 }
 
 static GActionEntry app_entries[] = {
diff --git a/src/gtr-notebook.c b/src/gtr-notebook.c
index 5c92ad97..c8e1e776 100644
--- a/src/gtr-notebook.c
+++ b/src/gtr-notebook.c
@@ -35,6 +35,7 @@ typedef struct
   GtkWidget *titlebar;
   GtkWidget *save;
   GtkWidget *sort_id;
+  GtkWidget *sortby_menu;
 
   GtkWidget *undo;
   GtkWidget *redo;
@@ -141,6 +142,7 @@ gtr_notebook_class_init (GtrNotebookClass * klass)
 
   gtk_widget_class_bind_template_child_private (widget_class, GtrNotebook, titlebar);
   gtk_widget_class_bind_template_child_private (widget_class, GtrNotebook, sort_id);
+  gtk_widget_class_bind_template_child_private (widget_class, GtrNotebook, sortby_menu);
   gtk_widget_class_bind_template_child_private (widget_class, GtrNotebook, undo);
   gtk_widget_class_bind_template_child_private (widget_class, GtrNotebook, redo);
   gtk_widget_class_bind_template_child_private (widget_class, GtrNotebook, save);
@@ -289,3 +291,12 @@ gtr_notebook_reset_sort (GtrNotebook *notebook)
   GtrNotebookPrivate *priv = gtr_notebook_get_instance_private (notebook);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->sort_id), TRUE);
 }
+
+void
+gtr_notebook_hide_sort_menu (GtrNotebook *notebook)
+{
+  GtrNotebookPrivate *priv = gtr_notebook_get_instance_private (notebook);
+
+  if (priv->sort_id)
+    gtk_menu_button_set_use_popover (GTK_MENU_BUTTON (priv->sortby_menu), FALSE);
+}
diff --git a/src/gtr-notebook.h b/src/gtr-notebook.h
index 38b85a28..2835eb83 100644
--- a/src/gtr-notebook.h
+++ b/src/gtr-notebook.h
@@ -81,5 +81,7 @@ void gtr_notebook_update_undo_buttons (GtrNotebook *notebook, GtrView *view);
 
 void gtr_notebook_reset_sort (GtrNotebook *notebook);
 
+void gtr_notebook_hide_sort_menu (GtrNotebook *notebook);
+
 G_END_DECLS
 #endif /* __NOTEBOOK_H__ */
diff --git a/src/gtr-window.c b/src/gtr-window.c
index 8ae84ba0..872c269a 100644
--- a/src/gtr-window.c
+++ b/src/gtr-window.c
@@ -1295,3 +1295,11 @@ gtr_window_tm_keybind (GtrWindow *window,
 
   g_list_free_full (tm_list, free_match);
 }
+
+void
+gtr_window_hide_sort_menu (GtrWindow *window)
+{
+  GtrWindowPrivate *priv = gtr_window_get_instance_private(window);
+
+  gtr_notebook_hide_sort_menu (GTR_NOTEBOOK (priv->notebook));
+}
diff --git a/src/gtr-window.h b/src/gtr-window.h
index 492b351e..7db93909 100644
--- a/src/gtr-window.h
+++ b/src/gtr-window.h
@@ -88,6 +88,8 @@ void gtr_window_remove_all_pages (GtrWindow *window);
 
 void gtr_window_tm_keybind (GtrWindow *window, GSimpleAction *action);
 
+void gtr_window_hide_sort_menu (GtrWindow *window);
+
 /** stack app states **/
 void gtr_window_show_projects (GtrWindow *window);
 void gtr_window_show_poeditor (GtrWindow *window);
diff --git a/src/help-overlay.ui b/src/help-overlay.ui
index 86311be1..c2181961 100644
--- a/src/help-overlay.ui
+++ b/src/help-overlay.ui
@@ -139,6 +139,13 @@
                 <property name="accelerator">&lt;Primary&gt;plus</property>
               </object>
             </child>
+            <child>
+              <object class="GtkShortcutsShortcut">
+                <property name="visible">true</property>
+                <property name="title" translatable="yes" context="shortcut window">Copy below</property>
+                <property name="accelerator">&lt;Primary&gt;space</property>
+              </object>
+            </child>
           </object>
         </child>
 


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