set parent of the about dialog
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 8 Jun 2016 15:46:57 +0000 (17:46 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 8 Jun 2016 15:46:57 +0000 (17:46 +0200)
src/ui.c
src/ui.h

index 61641f8..4ab4e5a 100644 (file)
--- 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;
index 42f2af7..12b6e2c 100644 (file)
--- 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);