From df5c07ee07ee2b1b058704db3ccadaf08510898a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 8 Jun 2016 17:46:57 +0200 Subject: [PATCH] set parent of the about dialog --- src/ui.c | 28 ++++++++++++++++++++++------ src/ui.h | 3 --- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/ui.c b/src/ui.c index 61641f8..4ab4e5a 100644 --- a/src/ui.c +++ b/src/ui.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2014 jeanfi@gmail.com + * Copyright (C) 2010-2016 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -198,18 +198,20 @@ on_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) return TRUE; } -void ui_show_about_dialog(void) +void ui_show_about_dialog(GtkWidget *parent) { static const char *const authors[] = { "jeanfi@gmail.com", NULL }; + log_fct("parent=%p", parent); + gtk_show_about_dialog - (NULL, + (parent, "authors", authors, "comments", _("Psensor is a GTK+ application for monitoring hardware " "sensors"), "copyright", - _("Copyright(c) 2010-2014 jeanfi@gmail.com"), + _("Copyright(c) 2010-2016 jeanfi@gmail.com"), #if GTK_CHECK_VERSION(3, 12, 0) "license-type", GTK_LICENSE_GPL_2_0, #endif @@ -223,9 +225,21 @@ void ui_show_about_dialog(void) NULL); } -void ui_cb_about(GtkMenuItem *mi, gpointer data) +void ui_cb_about(GtkAction *a, gpointer data) { - ui_show_about_dialog(); + struct ui_psensor *ui; + GtkWidget *parent; + + ui = (struct ui_psensor *)data; + + log_fct("ui=%p", ui); + + if (ui) + parent = ui->main_window; + else + parent = NULL; + + ui_show_about_dialog(parent); } void ui_cb_menu_quit(GtkMenuItem *mi, gpointer data) @@ -309,6 +323,8 @@ void ui_window_create(struct ui_psensor *ui) GtkBuilder *builder; GError *error; + log_fct("ui=%p", ui); + builder = gtk_builder_new(); error = NULL; diff --git a/src/ui.h b/src/ui.h index 42f2af7..12b6e2c 100644 --- a/src/ui.h +++ b/src/ui.h @@ -72,12 +72,9 @@ void ui_window_create(struct ui_psensor *ui); void ui_menu_bar_show(unsigned int show, struct ui_psensor *ui); -void ui_show_about_dialog(void); - void ui_enable_alpha_channel(struct ui_psensor *ui); void ui_cb_preferences(GtkMenuItem *mi, gpointer data); -void ui_cb_about(GtkMenuItem *mi, gpointer data); void ui_cb_menu_quit(GtkMenuItem *mi, gpointer data); void ui_cb_sensor_preferences(GtkMenuItem *mi, gpointer data); -- 2.7.4