From 25a24b5af992231732e58763786d7fc82914da8e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 3 Mar 2010 14:13:11 -0600 Subject: Provide the basis for the window --- src/gtk-dialog/dialog.c | 27 ++++++++++++++++++++++++--- src/gtk-dialog/dialog.h | 4 ++-- 2 files changed, 26 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gtk-dialog/dialog.c b/src/gtk-dialog/dialog.c index 186a506..9dcc194 100644 --- a/src/gtk-dialog/dialog.c +++ b/src/gtk-dialog/dialog.c @@ -26,9 +26,11 @@ static const gchar * button_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_SHUTDOWN, */ NC_("button", "Switch Off") }; +/* static const gchar * restart_updates = N_("Restart Instead"); static const gchar * restart_auth = N_("Restart..."); static const gchar * body_logout_update = N_("Some software updates won't apply until the computer next restarts."); +*/ static const gchar * icon_strings[LOGOUT_DIALOG_TYPE_CNT] = { /* LOGOUT_DIALOG_LOGOUT, */ "system-log-out", @@ -51,7 +53,7 @@ static void logout_dialog_init (LogoutDialog *self); static void logout_dialog_dispose (GObject *object); static void logout_dialog_finalize (GObject *object); -G_DEFINE_TYPE (LogoutDialog, logout_dialog, GTK_TYPE_DIALOG); +G_DEFINE_TYPE (LogoutDialog, logout_dialog, GTK_TYPE_MESSAGE_DIALOG); static void logout_dialog_class_init (LogoutDialogClass *klass) @@ -94,6 +96,25 @@ logout_dialog_finalize (GObject *object) LogoutDialog * logout_dialog_new (LogoutDialogType type) { - - return NULL; + LogoutDialog * dialog = LOGOUT_DIALOG(g_object_new(LOGOUT_DIALOG_TYPE, + /* Window */ + "icon-name", icon_strings[type], + "modal", TRUE, + "resizable", FALSE, + "title", _(title_strings[type]), + "window-position", GTK_WIN_POS_CENTER_ALWAYS, + /* Dialog */ + "has-separator", FALSE, + /* Message Dialog */ + "message-type", GTK_MESSAGE_OTHER, + "buttons", GTK_BUTTONS_NONE, + "text", _(body_strings[type]), + NULL)); + + gtk_dialog_add_buttons(GTK_DIALOG(dialog), + _(button_strings[type]), GTK_RESPONSE_OK, + _("Cancel"), GTK_RESPONSE_CANCEL, + NULL); + + return dialog; } diff --git a/src/gtk-dialog/dialog.h b/src/gtk-dialog/dialog.h index 1e6f575..3240a8e 100644 --- a/src/gtk-dialog/dialog.h +++ b/src/gtk-dialog/dialog.h @@ -27,11 +27,11 @@ typedef struct _LogoutDialog LogoutDialog; typedef struct _LogoutDialogClass LogoutDialogClass; struct _LogoutDialogClass { - GtkDialogClass parent_class; + GtkMessageDialogClass parent_class; }; struct _LogoutDialog { - GtkDialog parent; + GtkMessageDialog parent; }; GType logout_dialog_get_type (void); -- cgit v1.2.3