From 3b8aba0241bc23e2f4022523bedd177b38be030c Mon Sep 17 00:00:00 2001 From: Laurent Napias Date: Sun, 9 Jun 2019 21:41:01 +0200 Subject: [PATCH 1/2] Change url projet's website --- configure.ac | 2 +- mate-system-monitor.appdata.xml.in | 2 +- org.mate.mate-system-monitor.policy.in.in | 2 +- src/callbacks.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 1524bed7..79c8b999 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ([2.63]) AC_INIT([mate-system-monitor], [1.23.0], - [http://www.mate-desktop.org/]) + [https://mate-desktop.org/]) AC_CONFIG_SRCDIR(configure.ac) AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) diff --git a/mate-system-monitor.appdata.xml.in b/mate-system-monitor.appdata.xml.in index f640cdcd..9aefab8d 100644 --- a/mate-system-monitor.appdata.xml.in +++ b/mate-system-monitor.appdata.xml.in @@ -35,7 +35,7 @@ - http://www.mate-desktop.org + https://mate-desktop.org mate-dev@ml.mate-desktop.org MATE diff --git a/org.mate.mate-system-monitor.policy.in.in b/org.mate.mate-system-monitor.policy.in.in index 9ae59044..48fe482e 100644 --- a/org.mate.mate-system-monitor.policy.in.in +++ b/org.mate.mate-system-monitor.policy.in.in @@ -4,7 +4,7 @@ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd"> MATE Desktop - http://www.mate-desktop.org/ + https://mate-desktop.org/ utilities-system-monitor diff --git a/src/callbacks.cpp b/src/callbacks.cpp index 149e9556..138aaa26 100644 --- a/src/callbacks.cpp +++ b/src/callbacks.cpp @@ -214,7 +214,7 @@ cb_about (GtkAction *action, gpointer data) "translator-credits", _("translator-credits"), "license", license_trans, "wrap-license", TRUE, - "website", "http://www.mate-desktop.org", + "website", "https://mate-desktop.org", NULL ); From 4d84cd27a739b2352b10ccd62159b08abb234b58 Mon Sep 17 00:00:00 2001 From: Laurent Napias Date: Wed, 19 Jun 2019 20:47:40 +0200 Subject: [PATCH 2/2] Add scroll interface tabs with mouse wheel --- src/interface.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++ src/procdialogs.cpp | 65 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) diff --git a/src/interface.cpp b/src/interface.cpp index f7dbe84f..3df1b35e 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -195,6 +195,66 @@ static const char ui_info[] = " "; +static gboolean +dialog_page_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, GtkWindow *window) +{ + GtkNotebook *notebook = GTK_NOTEBOOK (widget); + GtkWidget *child, *event_widget, *action_widget; + + child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook)); + if (child == NULL) + return FALSE; + + event_widget = gtk_get_event_widget ((GdkEvent *) event); + + /* Ignore scroll events from the content of the page */ + if (event_widget == NULL || + event_widget == child || + gtk_widget_is_ancestor (event_widget, child)) + return FALSE; + + /* And also from the action widgets */ + action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START); + if (event_widget == action_widget || + (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget))) + return FALSE; + action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END); + if (event_widget == action_widget || + (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget))) + return FALSE; + + switch (event->direction) { + case GDK_SCROLL_RIGHT: + case GDK_SCROLL_DOWN: + gtk_notebook_next_page (notebook); + break; + case GDK_SCROLL_LEFT: + case GDK_SCROLL_UP: + gtk_notebook_prev_page (notebook); + break; + case GDK_SCROLL_SMOOTH: + switch (gtk_notebook_get_tab_pos (notebook)) { + case GTK_POS_LEFT: + case GTK_POS_RIGHT: + if (event->delta_y > 0) + gtk_notebook_next_page (notebook); + else if (event->delta_y < 0) + gtk_notebook_prev_page (notebook); + break; + case GTK_POS_TOP: + case GTK_POS_BOTTOM: + if (event->delta_x > 0) + gtk_notebook_next_page (notebook); + else if (event->delta_x < 0) + gtk_notebook_prev_page (notebook); + break; + } + break; + } + + return TRUE; +} + static GtkWidget * create_proc_view (ProcData *procdata) { @@ -701,6 +761,10 @@ create_main_window (ProcData *procdata) gtk_box_pack_start (GTK_BOX (main_box), notebook, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (notebook), 12); + gtk_widget_add_events (notebook, GDK_SCROLL_MASK); + g_signal_connect (notebook, "scroll-event", + G_CALLBACK (dialog_page_scroll_event_cb), GTK_WINDOW (app)); + sysinfo_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); // procman_create_sysinfo_view(); sysinfo_label = gtk_label_new(_("System")); gtk_notebook_append_page(GTK_NOTEBOOK(notebook), sysinfo_box, sysinfo_label); diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp index ee695bc3..09caa9ac 100644 --- a/src/procdialogs.cpp +++ b/src/procdialogs.cpp @@ -43,6 +43,66 @@ static GtkWidget *prefs_dialog = NULL; static gint new_nice_value = 0; +static gboolean +dialog_page_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, GtkWindow *window) +{ + GtkNotebook *notebook = GTK_NOTEBOOK (widget); + GtkWidget *child, *event_widget, *action_widget; + + child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook)); + if (child == NULL) + return FALSE; + + event_widget = gtk_get_event_widget ((GdkEvent *) event); + + /* Ignore scroll events from the content of the page */ + if (event_widget == NULL || + event_widget == child || + gtk_widget_is_ancestor (event_widget, child)) + return FALSE; + + /* And also from the action widgets */ + action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START); + if (event_widget == action_widget || + (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget))) + return FALSE; + action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END); + if (event_widget == action_widget || + (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget))) + return FALSE; + + switch (event->direction) { + case GDK_SCROLL_RIGHT: + case GDK_SCROLL_DOWN: + gtk_notebook_next_page (notebook); + break; + case GDK_SCROLL_LEFT: + case GDK_SCROLL_UP: + gtk_notebook_prev_page (notebook); + break; + case GDK_SCROLL_SMOOTH: + switch (gtk_notebook_get_tab_pos (notebook)) { + case GTK_POS_LEFT: + case GTK_POS_RIGHT: + if (event->delta_y > 0) + gtk_notebook_next_page (notebook); + else if (event->delta_y < 0) + gtk_notebook_prev_page (notebook); + break; + case GTK_POS_TOP: + case GTK_POS_BOTTOM: + if (event->delta_x > 0) + gtk_notebook_next_page (notebook); + else if (event->delta_x < 0) + gtk_notebook_prev_page (notebook); + break; + } + break; + } + + return TRUE; +} + static void kill_dialog_button_pressed (GtkDialog *dialog, gint id, gpointer data) { @@ -546,6 +606,11 @@ procdialog_create_preferences_dialog (ProcData *procdata) gtk_box_set_spacing (GTK_BOX (main_vbox), 2); notebook = gtk_notebook_new (); + + gtk_widget_add_events (notebook, GDK_SCROLL_MASK); + g_signal_connect (notebook, "scroll-event", + G_CALLBACK (dialog_page_scroll_event_cb), GTK_WINDOW (dialog)); + gtk_container_set_border_width (GTK_CONTAINER (notebook), 5); gtk_box_pack_start (GTK_BOX (main_vbox), notebook, TRUE, TRUE, 0);