Skip to content

Commit 54558c5

Browse files
committed
terminal-window: Fix: Session dbus daemon saturated
Fixes #233
1 parent e1b834a commit 54558c5

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/terminal-window.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ static gboolean terminal_window_focus_in_event (GtkWidget *widget,
159159

160160
static gboolean notebook_button_press_cb (GtkWidget *notebook,
161161
GdkEventButton *event,
162-
TerminalWindow *window);
162+
GSettings *settings);
163163
static gboolean window_key_press_cb (GtkWidget *notebook,
164164
GdkEventKey *event,
165-
TerminalWindow *window);
165+
GSettings *settings);
166166
static gboolean notebook_popup_menu_cb (GtkWidget *notebook,
167167
TerminalWindow *window);
168168
static void notebook_page_selected_callback (GtkWidget *notebook,
@@ -2187,6 +2187,8 @@ terminal_window_init (TerminalWindow *window)
21872187

21882188
GtkStyleContext *context;
21892189

2190+
GSettings *settings = g_settings_new ("org.mate.terminal.global");
2191+
21902192
context = gtk_widget_get_style_context (GTK_WIDGET (window));
21912193
gtk_style_context_add_class (context, "mate-terminal");
21922194

@@ -2205,9 +2207,9 @@ terminal_window_init (TerminalWindow *window)
22052207
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
22062208
gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
22072209
g_signal_connect (priv->notebook, "button-press-event",
2208-
G_CALLBACK (notebook_button_press_cb), window);
2210+
G_CALLBACK (notebook_button_press_cb), settings);
22092211
g_signal_connect (window, "key-press-event",
2210-
G_CALLBACK (window_key_press_cb), window);
2212+
G_CALLBACK (window_key_press_cb), settings);
22112213
g_signal_connect (priv->notebook, "popup-menu",
22122214
G_CALLBACK (notebook_popup_menu_cb), window);
22132215
g_signal_connect_after (priv->notebook, "switch-page",
@@ -2908,8 +2910,9 @@ terminal_window_get_active (TerminalWindow *window)
29082910
static gboolean
29092911
notebook_button_press_cb (GtkWidget *widget,
29102912
GdkEventButton *event,
2911-
TerminalWindow *window)
2913+
GSettings *settings)
29122914
{
2915+
TerminalWindow *window = TERMINAL_WINDOW (gtk_widget_get_toplevel (widget));
29132916
TerminalWindowPrivate *priv = window->priv;
29142917
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
29152918
GtkWidget *tab;
@@ -2919,9 +2922,6 @@ notebook_button_press_cb (GtkWidget *widget,
29192922
int page_num;
29202923
int before_pages;
29212924
int later_pages;
2922-
GSettings *settings;
2923-
2924-
settings = g_settings_new ("org.mate.terminal.global");
29252925

29262926
if ((event->type == GDK_BUTTON_PRESS && event->button == 2) &&
29272927
(g_settings_get_boolean (settings, "middle-click-closes-tabs")))
@@ -2984,15 +2984,12 @@ notebook_button_press_cb (GtkWidget *widget,
29842984
static gboolean
29852985
window_key_press_cb (GtkWidget *widget,
29862986
GdkEventKey *event,
2987-
TerminalWindow *window)
2987+
GSettings *settings)
29882988
{
2989-
GSettings *settings;
2990-
2991-
settings = g_settings_new ("org.mate.terminal.global");
2992-
29932989
if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs") &&
29942990
event->state & GDK_CONTROL_MASK)
29952991
{
2992+
TerminalWindow *window = TERMINAL_WINDOW (widget);
29962993
TerminalWindowPrivate *priv = window->priv;
29972994
GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);
29982995

0 commit comments

Comments
 (0)