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 055ca5b..92dc6cc 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 a53c051..b7cc432 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 15b479f..987bc68 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 399067e..71e0320 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 7abda57..b9e75ca 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 697c2f9..ee98c9e 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);
        }
 }