Skip to content

Commit

Permalink
terminal-window: Fix: Session dbus daemon saturated
Browse files Browse the repository at this point in the history
Fixes #233
  • Loading branch information
sc0w committed Jun 15, 2018
1 parent e1b834a commit 54558c5
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/terminal-window.c
Expand Up @@ -159,10 +159,10 @@ static gboolean terminal_window_focus_in_event (GtkWidget *widget,

static gboolean notebook_button_press_cb (GtkWidget *notebook,
GdkEventButton *event,
TerminalWindow *window);
GSettings *settings);
static gboolean window_key_press_cb (GtkWidget *notebook,
GdkEventKey *event,
TerminalWindow *window);
GSettings *settings);
static gboolean notebook_popup_menu_cb (GtkWidget *notebook,
TerminalWindow *window);
static void notebook_page_selected_callback (GtkWidget *notebook,
Expand Down Expand Up @@ -2187,6 +2187,8 @@ terminal_window_init (TerminalWindow *window)

GtkStyleContext *context;

GSettings *settings = g_settings_new ("org.mate.terminal.global");

context = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (context, "mate-terminal");

Expand All @@ -2205,9 +2207,9 @@ terminal_window_init (TerminalWindow *window)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
gtk_notebook_set_group_name (GTK_NOTEBOOK (priv->notebook), I_("mate-terminal-window"));
g_signal_connect (priv->notebook, "button-press-event",
G_CALLBACK (notebook_button_press_cb), window);
G_CALLBACK (notebook_button_press_cb), settings);
g_signal_connect (window, "key-press-event",
G_CALLBACK (window_key_press_cb), window);
G_CALLBACK (window_key_press_cb), settings);
g_signal_connect (priv->notebook, "popup-menu",
G_CALLBACK (notebook_popup_menu_cb), window);
g_signal_connect_after (priv->notebook, "switch-page",
Expand Down Expand Up @@ -2908,8 +2910,9 @@ terminal_window_get_active (TerminalWindow *window)
static gboolean
notebook_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
TerminalWindow *window)
GSettings *settings)
{
TerminalWindow *window = TERMINAL_WINDOW (gtk_widget_get_toplevel (widget));
TerminalWindowPrivate *priv = window->priv;
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkWidget *tab;
Expand All @@ -2919,9 +2922,6 @@ notebook_button_press_cb (GtkWidget *widget,
int page_num;
int before_pages;
int later_pages;
GSettings *settings;

settings = g_settings_new ("org.mate.terminal.global");

if ((event->type == GDK_BUTTON_PRESS && event->button == 2) &&
(g_settings_get_boolean (settings, "middle-click-closes-tabs")))
Expand Down Expand Up @@ -2984,15 +2984,12 @@ notebook_button_press_cb (GtkWidget *widget,
static gboolean
window_key_press_cb (GtkWidget *widget,
GdkEventKey *event,
TerminalWindow *window)
GSettings *settings)
{
GSettings *settings;

settings = g_settings_new ("org.mate.terminal.global");

if (g_settings_get_boolean (settings, "ctrl-tab-switch-tabs") &&
event->state & GDK_CONTROL_MASK)
{
TerminalWindow *window = TERMINAL_WINDOW (widget);
TerminalWindowPrivate *priv = window->priv;
GtkNotebook *notebook = GTK_NOTEBOOK (priv->notebook);

Expand Down

0 comments on commit 54558c5

Please sign in to comment.