Use folderview_grab_focus() outside of folderview.c.
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 21 Jul 2016 10:12:40 +0000 (12:12 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 21 Jul 2016 10:12:40 +0000 (12:12 +0200)
src/folderview.c
src/folderview.h
src/main.c
src/mainwindow.c
src/summaryview.c
src/toolbar.c

index 055ca5baad9dff4ac03af2ace2d7d3702ede350b..92dc6cc762c7fd8139aea2f50df7893597cdb51a 100644 (file)
@@ -3184,3 +3184,9 @@ void folderview_thaw(FolderView *folderview)
        if (folderview)
                gtk_cmclist_thaw(GTK_CMCLIST(folderview->ctree));
 }
+
+void folderview_grab_focus(FolderView *folderview)
+{
+        if (folderview)
+                gtk_widget_grab_focus(folderview->ctree);
+}
index a53c0511273838f2047edb6a113590508ee93600..b7cc43274c74108b008b00e2492ca24d0d429be5 100644 (file)
@@ -150,5 +150,6 @@ void folderview_close_opened                (FolderView             *folderview);
 
 void folderview_freeze(FolderView *folderview);
 void folderview_thaw(FolderView *folderview);
+void folderview_grab_focus(FolderView *folderview);
 
 #endif /* __FOLDERVIEW_H__ */
index 15b479f67244bfb41c85489bef16e5ed7b11c5aa..987bc6830e1dd8085a15aefb2fbb85aec95830f5 100644 (file)
@@ -1535,8 +1535,8 @@ int main(int argc, char *argv[])
        } else if (cmd.receive && !cmd.target) {
                start_done = FALSE;
                g_timeout_add(1000, defer_check, NULL);
-       } 
-       gtk_widget_grab_focus(folderview->ctree);
+       }
+       folderview_grab_focus(folderview);
 
        if (cmd.compose) {
                open_compose_new(cmd.compose_mailto, cmd.attach_files);
index 399067e09a2ec008607ea0e15286fcadfe2e748c..71e032071ed1040c0dd0567d6023c011dab56f03 100644 (file)
@@ -2922,7 +2922,7 @@ gboolean main_window_empty_trash(MainWindow *mainwin, gboolean confirm, gboolean
 
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->stype == F_TRASH)
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
        return TRUE;
 }
 
@@ -5441,7 +5441,7 @@ void mainwindow_exit_folder(MainWindow *mainwin) {
        if (prefs_common.layout_mode == SMALL_LAYOUT) {
                folderview_close_opened(mainwin->folderview);
                mainwin_paned_show_first(GTK_PANED(mainwin->hpaned));
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
        }
        mainwin->in_folder = FALSE;
        main_window_set_menu_sensitive(mainwin);
index 7abda5789e12d4fed6d2771234c642ec5a5fb887..b9e75ca38f39ecb4a7778f9a3d8e3982d4b4cceb 100644 (file)
@@ -4979,7 +4979,7 @@ gboolean summary_execute(SummaryView *summaryview)
        if (!GTK_CMCLIST(summaryview->ctree)->row_list) {
                menu_set_insensitive_all
                        (GTK_MENU_SHELL(summaryview->popupmenu));
-               gtk_widget_grab_focus(summaryview->folderview->ctree);
+               folderview_grab_focus(summaryview->folderview);
        } else {
                menu_set_sensitive_all(GTK_MENU_SHELL(summaryview->popupmenu), TRUE);
                gtk_widget_grab_focus(summaryview->ctree);
@@ -5080,7 +5080,7 @@ gboolean summary_expunge(SummaryView *summaryview)
        if (!GTK_CMCLIST(summaryview->ctree)->row_list) {
                menu_set_insensitive_all
                        (GTK_MENU_SHELL(summaryview->popupmenu));
-               gtk_widget_grab_focus(summaryview->folderview->ctree);
+               folderview_grab_focus(summaryview->folderview);
        } else {
                menu_set_sensitive_all(GTK_MENU_SHELL(summaryview->popupmenu), TRUE);
                gtk_widget_grab_focus(summaryview->ctree);
@@ -6604,7 +6604,7 @@ static gint summary_folder_eventbox_pressed(GtkWidget *eventbox, GdkEventButton
                                            SummaryView *summaryview)
 {
        if (event) {
-               gtk_widget_grab_focus(summaryview->folderview->ctree);
+               folderview_grab_focus(summaryview->folderview);
                mainwindow_exit_folder(summaryview->mainwin);
        }
        return TRUE;
@@ -6750,7 +6750,7 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
                        break;
                /* FALLTHROUGH */       
        case GDK_KEY_Escape:
-               gtk_widget_grab_focus(summaryview->folderview->ctree);
+               folderview_grab_focus(summaryview->folderview);
                mainwindow_exit_folder(summaryview->mainwin);
                return TRUE;
        case GDK_KEY_Home: case GDK_KEY_KP_Home:
index 697c2f96461877704cfa546497ccf513c91241ea..ee98c9ec83afb393361466139df8ddba229a6c8c 100644 (file)
@@ -1705,7 +1705,7 @@ static void toolbar_go_folders_cb(GtkWidget *widget, gpointer data)
                        folderview_select(mainwin->folderview, item);
                }
        } else {
-               gtk_widget_grab_focus(mainwin->folderview->ctree);
+               folderview_grab_focus(mainwin->folderview);
                mainwindow_exit_folder(mainwin);
        }
 }