summaryrefslogtreecommitdiff
path: root/capplet/gsm-app-dialog.c
diff options
context:
space:
mode:
Diffstat (limited to 'capplet/gsm-app-dialog.c')
-rw-r--r--capplet/gsm-app-dialog.c101
1 files changed, 40 insertions, 61 deletions
diff --git a/capplet/gsm-app-dialog.c b/capplet/gsm-app-dialog.c
index 04aaf28..fbcfbef 100644
--- a/capplet/gsm-app-dialog.c
+++ b/capplet/gsm-app-dialog.c
@@ -35,16 +35,15 @@
#define CAPPLET_COMMENT_ENTRY_WIDGET_NAME "session_properties_comment_entry"
#define CAPPLET_BROWSE_WIDGET_NAME "session_properties_browse_button"
-#define GSM_APP_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_APP_DIALOG, GsmAppDialogPrivate))
-
#ifdef __GNUC__
#define UNUSED_VARIABLE __attribute__ ((unused))
#else
#define UNUSED_VARIABLE
#endif
-struct GsmAppDialogPrivate
+struct _GsmAppDialog
{
+ GtkDialog parent;
GtkWidget *name_entry;
GtkWidget *command_entry;
GtkWidget *comment_entry;
@@ -56,7 +55,6 @@ struct GsmAppDialogPrivate
static void gsm_app_dialog_class_init (GsmAppDialogClass *klass);
static void gsm_app_dialog_init (GsmAppDialog *app_dialog);
-static void gsm_app_dialog_finalize (GObject *object);
enum {
PROP_0,
@@ -138,7 +136,7 @@ on_browse_button_clicked (GtkWidget *widget,
g_free (text);
- gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry), uri);
+ gtk_entry_set_text (GTK_ENTRY (dialog->command_entry), uri);
g_free (uri);
}
@@ -191,9 +189,9 @@ setup_dialog (GsmAppDialog *dialog)
gtk_dialog_add_button (GTK_DIALOG (dialog),
"gtk-cancel", GTK_RESPONSE_CANCEL);
- if (dialog->priv->name == NULL
- && dialog->priv->command == NULL
- && dialog->priv->comment == NULL) {
+ if (dialog->name == NULL
+ && dialog->command == NULL
+ && dialog->comment == NULL) {
gtk_window_set_title (GTK_WINDOW (dialog), _("Add Startup Program"));
gtk_dialog_add_button (GTK_DIALOG (dialog),
"gtk-add", GTK_RESPONSE_OK);
@@ -203,37 +201,37 @@ setup_dialog (GsmAppDialog *dialog)
"gtk-save", GTK_RESPONSE_OK);
}
- dialog->priv->name_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_NAME_ENTRY_WIDGET_NAME));
- g_signal_connect (dialog->priv->name_entry,
+ dialog->name_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_NAME_ENTRY_WIDGET_NAME));
+ g_signal_connect (dialog->name_entry,
"activate",
G_CALLBACK (on_entry_activate),
dialog);
- if (dialog->priv->name != NULL) {
- gtk_entry_set_text (GTK_ENTRY (dialog->priv->name_entry), dialog->priv->name);
+ if (dialog->name != NULL) {
+ gtk_entry_set_text (GTK_ENTRY (dialog->name_entry), dialog->name);
}
- dialog->priv->browse_button = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_BROWSE_WIDGET_NAME));
- g_signal_connect (dialog->priv->browse_button,
+ dialog->browse_button = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_BROWSE_WIDGET_NAME));
+ g_signal_connect (dialog->browse_button,
"clicked",
G_CALLBACK (on_browse_button_clicked),
dialog);
- dialog->priv->command_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMAND_ENTRY_WIDGET_NAME));
- g_signal_connect (dialog->priv->command_entry,
+ dialog->command_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMAND_ENTRY_WIDGET_NAME));
+ g_signal_connect (dialog->command_entry,
"activate",
G_CALLBACK (on_entry_activate),
dialog);
- if (dialog->priv->command != NULL) {
- gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry), dialog->priv->command);
+ if (dialog->command != NULL) {
+ gtk_entry_set_text (GTK_ENTRY (dialog->command_entry), dialog->command);
}
- dialog->priv->comment_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMENT_ENTRY_WIDGET_NAME));
- g_signal_connect (dialog->priv->comment_entry,
+ dialog->comment_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMENT_ENTRY_WIDGET_NAME));
+ g_signal_connect (dialog->comment_entry,
"activate",
G_CALLBACK (on_entry_activate),
dialog);
- if (dialog->priv->comment != NULL) {
- gtk_entry_set_text (GTK_ENTRY (dialog->priv->comment_entry), dialog->priv->comment);
+ if (dialog->comment != NULL) {
+ gtk_entry_set_text (GTK_ENTRY (dialog->comment_entry), dialog->comment);
}
if (xml != NULL) {
@@ -249,8 +247,8 @@ gsm_app_dialog_constructor (GType type,
GsmAppDialog *dialog;
dialog = GSM_APP_DIALOG (G_OBJECT_CLASS (gsm_app_dialog_parent_class)->constructor (type,
- n_construct_app,
- construct_app));
+ n_construct_app,
+ construct_app));
setup_dialog (dialog);
@@ -267,12 +265,12 @@ gsm_app_dialog_dispose (GObject *object)
dialog = GSM_APP_DIALOG (object);
- g_free (dialog->priv->name);
- dialog->priv->name = NULL;
- g_free (dialog->priv->command);
- dialog->priv->command = NULL;
- g_free (dialog->priv->comment);
- dialog->priv->comment = NULL;
+ g_free (dialog->name);
+ dialog->name = NULL;
+ g_free (dialog->command);
+ dialog->command = NULL;
+ g_free (dialog->comment);
+ dialog->comment = NULL;
G_OBJECT_CLASS (gsm_app_dialog_parent_class)->dispose (object);
}
@@ -283,9 +281,9 @@ gsm_app_dialog_set_name (GsmAppDialog *dialog,
{
g_return_if_fail (GSM_IS_APP_DIALOG (dialog));
- g_free (dialog->priv->name);
+ g_free (dialog->name);
- dialog->priv->name = g_strdup (name);
+ dialog->name = g_strdup (name);
g_object_notify (G_OBJECT (dialog), "name");
}
@@ -295,9 +293,9 @@ gsm_app_dialog_set_command (GsmAppDialog *dialog,
{
g_return_if_fail (GSM_IS_APP_DIALOG (dialog));
- g_free (dialog->priv->command);
+ g_free (dialog->command);
- dialog->priv->command = g_strdup (name);
+ dialog->command = g_strdup (name);
g_object_notify (G_OBJECT (dialog), "command");
}
@@ -307,9 +305,9 @@ gsm_app_dialog_set_comment (GsmAppDialog *dialog,
{
g_return_if_fail (GSM_IS_APP_DIALOG (dialog));
- g_free (dialog->priv->comment);
+ g_free (dialog->comment);
- dialog->priv->comment = g_strdup (name);
+ dialog->comment = g_strdup (name);
g_object_notify (G_OBJECT (dialog), "comment");
}
@@ -317,21 +315,21 @@ const char *
gsm_app_dialog_get_name (GsmAppDialog *dialog)
{
g_return_val_if_fail (GSM_IS_APP_DIALOG (dialog), NULL);
- return gtk_entry_get_text (GTK_ENTRY (dialog->priv->name_entry));
+ return gtk_entry_get_text (GTK_ENTRY (dialog->name_entry));
}
const char *
gsm_app_dialog_get_command (GsmAppDialog *dialog)
{
g_return_val_if_fail (GSM_IS_APP_DIALOG (dialog), NULL);
- return gtk_entry_get_text (GTK_ENTRY (dialog->priv->command_entry));
+ return gtk_entry_get_text (GTK_ENTRY (dialog->command_entry));
}
const char *
gsm_app_dialog_get_comment (GsmAppDialog *dialog)
{
g_return_val_if_fail (GSM_IS_APP_DIALOG (dialog), NULL);
- return gtk_entry_get_text (GTK_ENTRY (dialog->priv->comment_entry));
+ return gtk_entry_get_text (GTK_ENTRY (dialog->comment_entry));
}
static void
@@ -368,13 +366,13 @@ gsm_app_dialog_get_property (GObject *object,
switch (prop_id) {
case PROP_NAME:
- g_value_set_string (value, dialog->priv->name);
+ g_value_set_string (value, dialog->name);
break;
case PROP_COMMAND:
- g_value_set_string (value, dialog->priv->command);
+ g_value_set_string (value, dialog->command);
break;
case PROP_COMMENT:
- g_value_set_string (value, dialog->priv->comment);
+ g_value_set_string (value, dialog->comment);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -391,7 +389,6 @@ gsm_app_dialog_class_init (GsmAppDialogClass *klass)
object_class->set_property = gsm_app_dialog_set_property;
object_class->constructor = gsm_app_dialog_constructor;
object_class->dispose = gsm_app_dialog_dispose;
- object_class->finalize = gsm_app_dialog_finalize;
g_object_class_install_property (object_class,
PROP_NAME,
@@ -414,30 +411,12 @@ gsm_app_dialog_class_init (GsmAppDialogClass *klass)
"comment",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
-
- g_type_class_add_private (klass, sizeof (GsmAppDialogPrivate));
}
static void
gsm_app_dialog_init (GsmAppDialog *dialog)
{
- dialog->priv = GSM_APP_DIALOG_GET_PRIVATE (dialog);
-}
-
-static void
-gsm_app_dialog_finalize (GObject *object)
-{
- GsmAppDialog *dialog;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GSM_IS_APP_DIALOG (object));
-
- dialog = GSM_APP_DIALOG (object);
-
- g_return_if_fail (dialog->priv != NULL);
-
- G_OBJECT_CLASS (gsm_app_dialog_parent_class)->finalize (object);
}
GtkWidget *