Update (main): Use a GtkDialog rather than a GnomeDialog; don't place a

2001-12-20  Bradford Hovinen  <hovinen@ximian.com>

	* *-properties*.c (dialog_button_clicked_cb): Update
	(main): Use a GtkDialog rather than a GnomeDialog; don't place a
	weak ref on gtk_main_quit
This commit is contained in:
Bradford Hovinen 2001-12-20 18:21:12 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent cb0a578f7e
commit 2dd5ccf964
10 changed files with 91 additions and 32 deletions

View file

@ -265,12 +265,17 @@ create_dialog (BGApplier *bg_applier)
/* Callback issued when a button is clicked on the dialog */
static void
dialog_button_clicked_cb (GnomeDialog *dialog, gint button_number, GConfChangeSet *changeset)
dialog_button_clicked_cb (GnomeDialog *dialog, gint response_id, GConfChangeSet *changeset)
{
if (button_number == 0)
switch (response_id) {
case GTK_RESPONSE_APPLY:
gconf_client_commit_change_set (gconf_client_get_default (), changeset, TRUE, NULL);
else if (button_number == 1)
gnome_dialog_close (dialog);
break;
case GTK_RESPONSE_CLOSE:
gtk_main_quit ();
break;
}
}
int
@ -310,11 +315,16 @@ main (int argc, char **argv)
dialog = create_dialog (BG_APPLIER (bg_applier));
setup_dialog (dialog, changeset, BG_APPLIER (bg_applier));
dialog_win = gnome_dialog_new (_("Background properties"), GTK_STOCK_APPLY, GTK_STOCK_CLOSE, NULL);
g_signal_connect (G_OBJECT (dialog_win), "clicked", (GCallback) dialog_button_clicked_cb, changeset);
dialog_win = gtk_dialog_new_with_buttons
(_("Background properties"), NULL, -1,
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
g_signal_connect (G_OBJECT (dialog_win), "response", (GCallback) dialog_button_clicked_cb, changeset);
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) g_object_unref, bg_applier);
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) gtk_main_quit, NULL);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
gtk_widget_show_all (dialog_win);
gtk_main ();