gnome-system-tools r4158 - trunk/src/common



Author: carlosg
Date: Sat Feb 16 19:53:26 2008
New Revision: 4158
URL: http://svn.gnome.org/viewvc/gnome-system-tools?rev=4158&view=rev

Log:
2008-02-16  Carlos Garnacho  <carlosg gnome org>

        * gst-dialog.[ch] (gst_dialog_get_topmost_edit_dialog): Added.
        * gst-tool.[ch] (configuration_object_changed): Use topmost edit
        dialog as the parent for the "configuration changed" dialog. Also, do
        not show another of these dialogs if there's already one present.


Modified:
   trunk/src/common/ChangeLog
   trunk/src/common/gst-dialog.c
   trunk/src/common/gst-dialog.h
   trunk/src/common/gst-tool.c
   trunk/src/common/gst-tool.h

Modified: trunk/src/common/gst-dialog.c
==============================================================================
--- trunk/src/common/gst-dialog.c	(original)
+++ trunk/src/common/gst-dialog.c	Sat Feb 16 19:53:26 2008
@@ -650,6 +650,19 @@
 	return (priv->edit_dialogs != NULL);
 }
 
+GtkWidget *
+gst_dialog_get_topmost_edit_dialog (GstDialog *dialog)
+{
+	GstDialogPrivate *priv;
+
+	priv = GST_DIALOG_GET_PRIVATE (dialog);
+
+	if (!priv->edit_dialogs)
+		return NULL;
+
+	return GTK_WIDGET (priv->edit_dialogs->data);
+}
+
 void
 gst_dialog_add_edit_dialog (GstDialog *dialog,
 			    GtkWidget *edit_dialog)

Modified: trunk/src/common/gst-dialog.h
==============================================================================
--- trunk/src/common/gst-dialog.h	(original)
+++ trunk/src/common/gst-dialog.h	Sat Feb 16 19:53:26 2008
@@ -86,6 +86,7 @@
 						    GtkWidget *edit_dialog);
 void                gst_dialog_stop_editing        (GstDialog *dialog);
 gboolean            gst_dialog_get_editing         (GstDialog *dialog);
+GtkWidget *         gst_dialog_get_topmost_edit_dialog (GstDialog *dialog);
 
 
 G_END_DECLS

Modified: trunk/src/common/gst-tool.c
==============================================================================
--- trunk/src/common/gst-tool.c	(original)
+++ trunk/src/common/gst-tool.c	Sat Feb 16 19:53:26 2008
@@ -567,19 +567,27 @@
 	gboolean do_update = TRUE;
 
 	if (gst_dialog_get_editing (tool->main_dialog)) {
-		GtkWidget *dialog;
+		GtkWidget *parent, *dialog;
 		gint response;
 
-		dialog = gtk_message_dialog_new (GTK_WINDOW (tool->main_dialog),
+		if (tool->configuration_changed_dialog)
+			return;
+
+		parent = gst_dialog_get_topmost_edit_dialog (tool->main_dialog);
+		dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
 						 GTK_DIALOG_MODAL,
 						 GTK_MESSAGE_QUESTION,
 						 GTK_BUTTONS_YES_NO,
 						 _("The system configuration has potentially changed."));
 		gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
 							  _("Update content? This will lose any modification in course."));
+		tool->configuration_changed_dialog = dialog;
+
 		response = gtk_dialog_run (GTK_DIALOG (dialog));
 		do_update = (response == GTK_RESPONSE_YES);
-		gtk_widget_hide (dialog);
+
+		gtk_widget_destroy (dialog);
+		tool->configuration_changed_dialog = NULL;
 	}
 
 	if (do_update) {

Modified: trunk/src/common/gst-tool.h
==============================================================================
--- trunk/src/common/gst-tool.h	(original)
+++ trunk/src/common/gst-tool.h	Sat Feb 16 19:53:26 2008
@@ -58,6 +58,7 @@
 
 	GtkIconTheme *icon_theme;
 	GstDialog *main_dialog;
+	GtkWidget *configuration_changed_dialog;
 
 	/* Progress report widgets */
 	GtkWidget *report_window;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]