commit 96ca00e6bc56bacf13d9e492f109875d6ecb046b
parent 4306c9eaa2f13d2fe56938f66b40e5a187242821
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Thu, 21 Jul 2016 12:12:40 +0200
Use folderview_grab_focus() outside of folderview.c.
Diffstat:
6 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/folderview.c b/src/folderview.c
@@ -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);
+}
diff --git a/src/folderview.h b/src/folderview.h
@@ -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__ */
diff --git a/src/main.c b/src/main.c
@@ -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);
diff --git a/src/mainwindow.c b/src/mainwindow.c
@@ -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);
diff --git a/src/summaryview.c b/src/summaryview.c
@@ -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:
diff --git a/src/toolbar.c b/src/toolbar.c
@@ -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);
}
}