summaryrefslogtreecommitdiff
path: root/capplet
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2018-11-19 14:12:59 +0800
committerraveit65 <[email protected]>2018-11-26 13:02:53 +0100
commit6b7875b9714d5872f80b6b4012f24fb8f548aca2 (patch)
treebf3ba2f47a359ecad1281604cb869fbfe1200a05 /capplet
parentbdec713320b7487c429bd4415fdde55cf48cb44b (diff)
downloadmate-session-manager-6b7875b9714d5872f80b6b4012f24fb8f548aca2.tar.bz2
mate-session-manager-6b7875b9714d5872f80b6b4012f24fb8f548aca2.tar.xz
Avoid compile warning for g_type_class_add_private
- capplet/gsm-app-dialog.c - capplet/gsm-app-dialog.h - capplet/gsm-properties-dialog.c - capplet/gsm-properties-dialog.h - capplet/gsp-app-manager.c - capplet/gsp-app-manager.h - capplet/gsp-app.c - capplet/gsp-app.h - mate-session/gsm-app.c - mate-session/gsm-app.h - mate-session/gsm-autostart-app.c - mate-session/gsm-autostart-app.h - mate-session/gsm-client.c - mate-session/gsm-client.h - mate-session/gsm-consolekit.c - mate-session/gsm-consolekit.h - mate-session/gsm-dbus-client.c - mate-session/gsm-dbus-client.h - mate-session/gsm-inhibit-dialog.c - mate-session/gsm-inhibit-dialog.h - mate-session/gsm-inhibitor.c - mate-session/gsm-inhibitor.h - mate-session/gsm-logout-dialog.c - mate-session/gsm-logout-dialog.h - mate-session/gsm-store.c - mate-session/gsm-store.h - mate-session/gsm-systemd.c - mate-session/gsm-systemd.h - mate-session/gsm-xsmp-client.c - mate-session/gsm-xsmp-client.h - mate-session/gsm-xsmp-server.c - mate-session/gsm-xsmp-server.h
Diffstat (limited to 'capplet')
-rw-r--r--capplet/gsm-app-dialog.c101
-rw-r--r--capplet/gsm-app-dialog.h31
-rw-r--r--capplet/gsm-properties-dialog.c133
-rw-r--r--capplet/gsm-properties-dialog.h29
-rw-r--r--capplet/gsp-app-manager.c77
-rw-r--r--capplet/gsp-app-manager.h28
-rw-r--r--capplet/gsp-app.c488
-rw-r--r--capplet/gsp-app.h28
8 files changed, 455 insertions, 460 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 *
diff --git a/capplet/gsm-app-dialog.h b/capplet/gsm-app-dialog.h
index 8fc5b52..5869242 100644
--- a/capplet/gsm-app-dialog.h
+++ b/capplet/gsm-app-dialog.h
@@ -24,31 +24,10 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
-#define GSM_TYPE_APP_DIALOG (gsm_app_dialog_get_type ())
-#define GSM_APP_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSM_TYPE_APP_DIALOG, GsmAppDialog))
-#define GSM_APP_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSM_TYPE_APP_DIALOG, GsmAppDialogClass))
-#define GSM_IS_APP_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSM_TYPE_APP_DIALOG))
-#define GSM_IS_APP_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSM_TYPE_APP_DIALOG))
-#define GSM_APP_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSM_TYPE_APP_DIALOG, GsmAppDialogClass))
-
-typedef struct GsmAppDialogPrivate GsmAppDialogPrivate;
-
-typedef struct
-{
- GtkDialog parent;
- GsmAppDialogPrivate *priv;
-} GsmAppDialog;
-
-typedef struct
-{
- GtkDialogClass parent_class;
-} GsmAppDialogClass;
-
-GType gsm_app_dialog_get_type (void);
+#define GSM_TYPE_APP_DIALOG (gsm_app_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (GsmAppDialog, gsm_app_dialog, GSM, APP_DIALOG, GtkDialog)
GtkWidget * gsm_app_dialog_new (const char *name,
const char *command,
@@ -63,8 +42,6 @@ const char * gsm_app_dialog_get_name (GsmAppDialog *dialog);
const char * gsm_app_dialog_get_command (GsmAppDialog *dialog);
const char * gsm_app_dialog_get_comment (GsmAppDialog *dialog);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __GSM_APP_DIALOG_H */
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 09042a6..e6463cd 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -35,8 +35,6 @@
#include "gsp-app.h"
#include "gsp-app-manager.h"
-#define GSM_PROPERTIES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogPrivate))
-
#define GTKBUILDER_FILE "session-properties.ui"
#define CAPPLET_TREEVIEW_WIDGET_NAME "session_properties_treeview"
@@ -51,8 +49,9 @@
#define SPC_CONFIG_SCHEMA "org.mate.session"
#define SPC_AUTOSAVE_KEY "auto-save-session"
-struct GsmPropertiesDialogPrivate
+struct _GsmPropertiesDialog
{
+ GtkDialog parent;
GtkBuilder *xml;
GtkListStore *list_store;
GtkTreeModel *tree_filter;
@@ -167,12 +166,12 @@ _app_changed (GsmPropertiesDialog *dialog,
{
GtkTreeIter iter;
- if (!find_by_app (GTK_TREE_MODEL (dialog->priv->list_store),
+ if (!find_by_app (GTK_TREE_MODEL (dialog->list_store),
&iter, app)) {
return;
}
- _fill_iter_from_app (dialog->priv->list_store, &iter, app);
+ _fill_iter_from_app (dialog->list_store, &iter, app);
}
static void
@@ -181,8 +180,8 @@ append_app (GsmPropertiesDialog *dialog,
{
GtkTreeIter iter;
- gtk_list_store_append (dialog->priv->list_store, &iter);
- _fill_iter_from_app (dialog->priv->list_store, &iter, app);
+ gtk_list_store_append (dialog->list_store, &iter);
+ _fill_iter_from_app (dialog->list_store, &iter, app);
g_signal_connect_swapped (app, "changed",
G_CALLBACK (_app_changed), dialog);
@@ -203,7 +202,7 @@ _app_removed (GsmPropertiesDialog *dialog,
{
GtkTreeIter iter;
- if (!find_by_app (GTK_TREE_MODEL (dialog->priv->list_store),
+ if (!find_by_app (GTK_TREE_MODEL (dialog->list_store),
&iter, app)) {
return;
}
@@ -211,7 +210,7 @@ _app_removed (GsmPropertiesDialog *dialog,
g_signal_handlers_disconnect_by_func (app,
_app_changed,
dialog);
- gtk_list_store_remove (dialog->priv->list_store, &iter);
+ gtk_list_store_remove (dialog->list_store, &iter);
}
static void
@@ -220,7 +219,7 @@ populate_model (GsmPropertiesDialog *dialog)
GSList *apps;
GSList *l;
- apps = gsp_app_manager_get_apps (dialog->priv->manager);
+ apps = gsp_app_manager_get_apps (dialog->manager);
for (l = apps; l != NULL; l = l->next) {
append_app (dialog, GSP_APP (l->data));
}
@@ -235,8 +234,8 @@ on_selection_changed (GtkTreeSelection *selection,
sel = gtk_tree_selection_get_selected (selection, NULL, NULL);
- gtk_widget_set_sensitive (dialog->priv->edit_button, sel);
- gtk_widget_set_sensitive (dialog->priv->delete_button, sel);
+ gtk_widget_set_sensitive (dialog->edit_button, sel);
+ gtk_widget_set_sensitive (dialog->delete_button, sel);
}
static void
@@ -248,13 +247,13 @@ on_startup_enabled_toggled (GtkCellRendererToggle *cell_renderer,
GspApp *app;
gboolean active;
- if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (dialog->priv->tree_filter),
+ if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (dialog->tree_filter),
&iter, path)) {
return;
}
app = NULL;
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter),
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->tree_filter),
&iter,
STORE_COL_APP, &app,
-1);
@@ -312,11 +311,11 @@ on_drag_begin (GtkWidget *widget,
GspApp *app;
gtk_tree_view_get_cursor (GTK_TREE_VIEW (widget), &path, NULL);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->priv->tree_filter),
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->tree_filter),
&iter, path);
gtk_tree_path_free (path);
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter),
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->tree_filter),
&iter,
STORE_COL_APP, &app,
-1);
@@ -384,14 +383,14 @@ on_delete_app_clicked (GtkWidget *widget,
GtkTreeIter iter;
GspApp *app;
- selection = gtk_tree_view_get_selection (dialog->priv->treeview);
+ selection = gtk_tree_view_get_selection (dialog->treeview);
if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
return;
}
app = NULL;
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter),
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->tree_filter),
&iter,
STORE_COL_APP, &app,
-1);
@@ -410,14 +409,14 @@ on_edit_app_clicked (GtkWidget *widget,
GtkTreeIter iter;
GspApp *app;
- selection = gtk_tree_view_get_selection (dialog->priv->treeview);
+ selection = gtk_tree_view_get_selection (dialog->treeview);
if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) {
return;
}
app = NULL;
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter),
+ gtk_tree_model_get (GTK_TREE_MODEL (dialog->tree_filter),
&iter,
STORE_COL_APP, &app,
-1);
@@ -478,24 +477,24 @@ setup_dialog (GsmPropertiesDialog *dialog)
"gtk-close", GTK_RESPONSE_CLOSE,
NULL);
- dialog->priv->list_store = gtk_list_store_new (NUMBER_OF_COLUMNS,
- G_TYPE_BOOLEAN,
- G_TYPE_BOOLEAN,
- G_TYPE_ICON,
- G_TYPE_STRING,
- G_TYPE_OBJECT,
- G_TYPE_STRING);
- tree_filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (dialog->priv->list_store),
+ dialog->list_store = gtk_list_store_new (NUMBER_OF_COLUMNS,
+ G_TYPE_BOOLEAN,
+ G_TYPE_BOOLEAN,
+ G_TYPE_ICON,
+ G_TYPE_STRING,
+ G_TYPE_OBJECT,
+ G_TYPE_STRING);
+ tree_filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (dialog->list_store),
NULL);
- g_object_unref (dialog->priv->list_store);
- dialog->priv->tree_filter = tree_filter;
+ g_object_unref (dialog->list_store);
+ dialog->tree_filter = tree_filter;
gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (tree_filter),
STORE_COL_VISIBLE);
- treeview = GTK_TREE_VIEW (gtk_builder_get_object (dialog->priv->xml,
+ treeview = GTK_TREE_VIEW (gtk_builder_get_object (dialog->xml,
CAPPLET_TREEVIEW_WIDGET_NAME));
- dialog->priv->treeview = treeview;
+ dialog->treeview = treeview;
gtk_tree_view_set_model (treeview, tree_filter);
g_object_unref (tree_filter);
@@ -590,56 +589,56 @@ setup_dialog (GsmPropertiesDialog *dialog)
G_CALLBACK (on_drag_data_received),
dialog);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->priv->list_store),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->list_store),
STORE_COL_DESCRIPTION,
GTK_SORT_ASCENDING);
- button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+ button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
CAPPLET_ADD_WIDGET_NAME));
- dialog->priv->add_button = button;
+ dialog->add_button = button;
g_signal_connect (button,
"clicked",
G_CALLBACK (on_add_app_clicked),
dialog);
- button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+ button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
CAPPLET_DELETE_WIDGET_NAME));
- dialog->priv->delete_button = button;
+ dialog->delete_button = button;
g_signal_connect (button,
"clicked",
G_CALLBACK (on_delete_app_clicked),
dialog);
- button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+ button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
CAPPLET_EDIT_WIDGET_NAME));
- dialog->priv->edit_button = button;
+ dialog->edit_button = button;
g_signal_connect (button,
"clicked",
G_CALLBACK (on_edit_app_clicked),
dialog);
- dialog->priv->settings = g_settings_new (SPC_CONFIG_SCHEMA);
+ dialog->settings = g_settings_new (SPC_CONFIG_SCHEMA);
- button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+ button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
CAPPLET_REMEMBER_WIDGET_NAME));
- g_settings_bind (dialog->priv->settings, SPC_AUTOSAVE_KEY,
+ g_settings_bind (dialog->settings, SPC_AUTOSAVE_KEY,
button, "active", G_SETTINGS_BIND_DEFAULT);
- button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+ button = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
CAPPLET_SAVE_WIDGET_NAME));
g_signal_connect (button,
"clicked",
G_CALLBACK (on_save_session_clicked),
dialog);
- dialog->priv->manager = gsp_app_manager_get ();
- gsp_app_manager_fill (dialog->priv->manager);
- g_signal_connect_swapped (dialog->priv->manager, "added",
+ dialog->manager = gsp_app_manager_get ();
+ gsp_app_manager_fill (dialog->manager);
+ g_signal_connect_swapped (dialog->manager, "added",
G_CALLBACK (_app_added), dialog);
- g_signal_connect_swapped (dialog->priv->manager, "removed",
+ g_signal_connect_swapped (dialog->manager, "removed",
G_CALLBACK (_app_removed), dialog);
populate_model (dialog);
@@ -653,8 +652,8 @@ gsm_properties_dialog_constructor (GType type,
GsmPropertiesDialog *dialog;
dialog = GSM_PROPERTIES_DIALOG (G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->constructor (type,
- n_construct_properties,
- construct_properties));
+ n_construct_properties,
+ construct_properties));
setup_dialog (dialog);
@@ -671,14 +670,14 @@ gsm_properties_dialog_dispose (GObject *object)
dialog = GSM_PROPERTIES_DIALOG (object);
- if (dialog->priv->xml != NULL) {
- g_object_unref (dialog->priv->xml);
- dialog->priv->xml = NULL;
+ if (dialog->xml != NULL) {
+ g_object_unref (dialog->xml);
+ dialog->xml = NULL;
}
- if (dialog->priv->settings != NULL) {
- g_object_unref (dialog->priv->settings);
- dialog->priv->settings = NULL;
+ if (dialog->settings != NULL) {
+ g_object_unref (dialog->settings);
+ dialog->settings = NULL;
}
G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->dispose (object);
@@ -686,9 +685,9 @@ gsm_properties_dialog_dispose (GObject *object)
/* it's important to do this after chaining to the parent dispose
* method because we want to make sure the treeview has been disposed
* and removed all its references to GspApp objects */
- if (dialog->priv->manager != NULL) {
- g_object_unref (dialog->priv->manager);
- dialog->priv->manager = NULL;
+ if (dialog->manager != NULL) {
+ g_object_unref (dialog->manager);
+ dialog->manager = NULL;
}
}
@@ -700,8 +699,6 @@ gsm_properties_dialog_class_init (GsmPropertiesDialogClass *klass)
object_class->constructor = gsm_properties_dialog_constructor;
object_class->dispose = gsm_properties_dialog_dispose;
object_class->finalize = gsm_properties_dialog_finalize;
-
- g_type_class_add_private (klass, sizeof (GsmPropertiesDialogPrivate));
}
static void
@@ -711,13 +708,11 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
GtkWidget *widget;
GError *error;
- dialog->priv = GSM_PROPERTIES_DIALOG_GET_PRIVATE (dialog);
-
- dialog->priv->xml = gtk_builder_new ();
- gtk_builder_set_translation_domain (dialog->priv->xml, GETTEXT_PACKAGE);
+ dialog->xml = gtk_builder_new ();
+ gtk_builder_set_translation_domain (dialog->xml, GETTEXT_PACKAGE);
error = NULL;
- if (!gtk_builder_add_from_file (dialog->priv->xml,
+ if (!gtk_builder_add_from_file (dialog->xml,
GTKBUILDER_DIR "/" GTKBUILDER_FILE,
&error)) {
if (error) {
@@ -730,7 +725,7 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
}
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml,
+ widget = GTK_WIDGET (gtk_builder_get_object (dialog->xml,
"main-notebook"));
gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
@@ -744,15 +739,9 @@ gsm_properties_dialog_init (GsmPropertiesDialog *dialog)
static void
gsm_properties_dialog_finalize (GObject *object)
{
- GsmPropertiesDialog *dialog;
-
g_return_if_fail (object != NULL);
g_return_if_fail (GSM_IS_PROPERTIES_DIALOG (object));
- dialog = GSM_PROPERTIES_DIALOG (object);
-
- g_return_if_fail (dialog->priv != NULL);
-
G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->finalize (object);
}
diff --git a/capplet/gsm-properties-dialog.h b/capplet/gsm-properties-dialog.h
index 0103581..93ef91b 100644
--- a/capplet/gsm-properties-dialog.h
+++ b/capplet/gsm-properties-dialog.h
@@ -24,38 +24,15 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define GSM_TYPE_PROPERTIES_DIALOG (gsm_properties_dialog_get_type ())
-#define GSM_PROPERTIES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialog))
-#define GSM_PROPERTIES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogClass))
-#define GSM_IS_PROPERTIES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSM_TYPE_PROPERTIES_DIALOG))
-#define GSM_IS_PROPERTIES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSM_TYPE_PROPERTIES_DIALOG))
-#define GSM_PROPERTIES_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogClass))
-
-typedef struct GsmPropertiesDialogPrivate GsmPropertiesDialogPrivate;
-
-typedef struct
-{
- GtkDialog parent;
- GsmPropertiesDialogPrivate *priv;
-} GsmPropertiesDialog;
-
-typedef struct
-{
- GtkDialogClass parent_class;
-} GsmPropertiesDialogClass;
-
-GType gsm_properties_dialog_get_type (void);
+G_DECLARE_FINAL_TYPE (GsmPropertiesDialog, gsm_properties_dialog, GSM, PROPERTIES_DIALOG, GtkDialog)
GtkWidget * gsm_properties_dialog_new (void);
#define GSM_PROPERTIES_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __GSM_PROPERTIES_DIALOG_H */
diff --git a/capplet/gsp-app-manager.c b/capplet/gsp-app-manager.c
index be22c87..7e245db 100644
--- a/capplet/gsp-app-manager.c
+++ b/capplet/gsp-app-manager.c
@@ -36,13 +36,10 @@ typedef struct {
GFileMonitor *monitor;
} GspXdgDir;
-struct _GspAppManagerPrivate {
+typedef struct {
GSList *apps;
GSList *dirs;
-};
-
-#define GSP_APP_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSP_TYPE_APP_MANAGER, GspAppManagerPrivate))
-
+} GspAppManagerPrivate;
enum {
ADDED,
@@ -53,7 +50,7 @@ enum {
static guint gsp_app_manager_signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (GspAppManager, gsp_app_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GspAppManager, gsp_app_manager, G_TYPE_OBJECT)
static void gsp_app_manager_dispose (GObject *object);
static void gsp_app_manager_finalize (GObject *object);
@@ -124,33 +121,36 @@ gsp_app_manager_class_init (GspAppManagerClass *class)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
- g_type_class_add_private (class, sizeof (GspAppManagerPrivate));
}
static void
gsp_app_manager_init (GspAppManager *manager)
{
- manager->priv = GSP_APP_MANAGER_GET_PRIVATE (manager);
+ GspAppManagerPrivate *priv;
+ priv = gsp_app_manager_get_instance_private (manager);
- memset (manager->priv, 0, sizeof (GspAppManagerPrivate));
+ // is needed?
+ memset (priv, 0, sizeof (GspAppManagerPrivate));
}
static void
gsp_app_manager_dispose (GObject *object)
{
GspAppManager *manager;
+ GspAppManagerPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GSP_IS_APP_MANAGER (object));
manager = GSP_APP_MANAGER (object);
+ priv = gsp_app_manager_get_instance_private (manager);
/* we unref GspApp objects in dispose since they might need to
* reference us during their dispose/finalize */
- g_slist_foreach (manager->priv->apps,
+ g_slist_foreach (priv->apps,
(GFunc) _gsp_app_manager_app_unref, manager);
- g_slist_free (manager->priv->apps);
- manager->priv->apps = NULL;
+ g_slist_free (priv->apps);
+ priv->apps = NULL;
G_OBJECT_CLASS (gsp_app_manager_parent_class)->dispose (object);
}
@@ -159,16 +159,18 @@ static void
gsp_app_manager_finalize (GObject *object)
{
GspAppManager *manager;
+ GspAppManagerPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GSP_IS_APP_MANAGER (object));
manager = GSP_APP_MANAGER (object);
+ priv = gsp_app_manager_get_instance_private (manager);
- g_slist_foreach (manager->priv->dirs,
+ g_slist_foreach (priv->dirs,
(GFunc) _gsp_xdg_dir_free, NULL);
- g_slist_free (manager->priv->dirs);
- manager->priv->dirs = NULL;
+ g_slist_free (priv->dirs);
+ priv->dirs = NULL;
G_OBJECT_CLASS (gsp_app_manager_parent_class)->finalize (object);
@@ -201,11 +203,14 @@ gsp_app_manager_get_dir_index (GspAppManager *manager,
{
GSList *l;
GspXdgDir *xdgdir;
+ GspAppManagerPrivate *priv;
g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), -1);
g_return_val_if_fail (dir != NULL, -1);
- for (l = manager->priv->dirs; l != NULL; l = l->next) {
+ priv = gsp_app_manager_get_instance_private (manager);
+
+ for (l = priv->dirs; l != NULL; l = l->next) {
xdgdir = l->data;
if (strcmp (dir, xdgdir->dir) == 0) {
return xdgdir->index;
@@ -221,10 +226,13 @@ gsp_app_manager_get_dir (GspAppManager *manager,
{
GSList *l;
GspXdgDir *xdgdir;
+ GspAppManagerPrivate *priv;
g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), NULL);
- for (l = manager->priv->dirs; l != NULL; l = l->next) {
+ priv = gsp_app_manager_get_instance_private (manager);
+
+ for (l = priv->dirs; l != NULL; l = l->next) {
xdgdir = l->data;
if (index == xdgdir->index) {
return xdgdir->dir;
@@ -244,11 +252,13 @@ _gsp_app_manager_find_dir_with_basename (GspAppManager *manager,
char *path;
GKeyFile *keyfile;
int result = -1;
+ GspAppManagerPrivate *priv;
path = NULL;
keyfile = g_key_file_new ();
+ priv = gsp_app_manager_get_instance_private (manager);
- for (l = manager->priv->dirs; l != NULL; l = l->next) {
+ for (l = priv->dirs; l != NULL; l = l->next) {
xdgdir = l->data;
if (xdgdir->index <= minimum_index) {
@@ -485,8 +495,11 @@ gsp_app_manager_fill (GspAppManager *manager)
{
char **autostart_dirs;
int i;
+ GspAppManagerPrivate *priv;
+
+ priv = gsp_app_manager_get_instance_private (manager);
- if (manager->priv->apps != NULL)
+ if (priv->apps != NULL)
return;
autostart_dirs = gsm_util_get_autostart_dirs ();
@@ -503,7 +516,7 @@ gsp_app_manager_fill (GspAppManager *manager)
}
xdgdir = _gsp_xdg_dir_new (autostart_dirs[i], i);
- manager->priv->dirs = g_slist_prepend (manager->priv->dirs,
+ priv->dirs = g_slist_prepend (priv->dirs,
xdgdir);
_gsp_app_manager_fill_from_dir (manager, xdgdir);
@@ -530,8 +543,11 @@ static void
_gsp_app_manager_app_removed (GspAppManager *manager,
GspApp *app)
{
+ GspAppManagerPrivate *priv;
+
_gsp_app_manager_emit_removed (manager, app);
- manager->priv->apps = g_slist_remove (manager->priv->apps, app);
+ priv = gsp_app_manager_get_instance_private (manager);
+ priv->apps = g_slist_remove (priv->apps, app);
_gsp_app_manager_app_unref (app, manager);
}
@@ -539,11 +555,15 @@ void
gsp_app_manager_add (GspAppManager *manager,
GspApp *app)
{
+ GspAppManagerPrivate *priv;
+
g_return_if_fail (GSP_IS_APP_MANAGER (manager));
g_return_if_fail (GSP_IS_APP (app));
- manager->priv->apps = g_slist_prepend (manager->priv->apps,
- g_object_ref (app));
+ priv = gsp_app_manager_get_instance_private (manager);
+
+ priv->apps = g_slist_prepend (priv->apps,
+ g_object_ref (app));
g_signal_connect_swapped (app, "removed",
G_CALLBACK (_gsp_app_manager_app_removed),
manager);
@@ -556,11 +576,14 @@ gsp_app_manager_find_app_with_basename (GspAppManager *manager,
{
GSList *l;
GspApp *app;
+ GspAppManagerPrivate *priv;
g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), NULL);
g_return_val_if_fail (basename != NULL, NULL);
- for (l = manager->priv->apps; l != NULL; l = l->next) {
+ priv = gsp_app_manager_get_instance_private (manager);
+
+ for (l = priv->apps; l != NULL; l = l->next) {
app = GSP_APP (l->data);
if (strcmp (basename, gsp_app_get_basename (app)) == 0)
return app;
@@ -587,7 +610,11 @@ gsp_app_manager_get (void)
GSList *
gsp_app_manager_get_apps (GspAppManager *manager)
{
+ GspAppManagerPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), NULL);
- return g_slist_copy (manager->priv->apps);
+ priv = gsp_app_manager_get_instance_private (manager);
+
+ return g_slist_copy (priv->apps);
}
diff --git a/capplet/gsp-app-manager.h b/capplet/gsp-app-manager.h
index 11bf8a9..b3ceb1e 100644
--- a/capplet/gsp-app-manager.h
+++ b/capplet/gsp-app-manager.h
@@ -28,21 +28,10 @@
#include <gsp-app.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define GSP_TYPE_APP_MANAGER (gsp_app_manager_get_type ())
-#define GSP_APP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSP_TYPE_APP_MANAGER, GspAppManager))
-#define GSP_APP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSP_TYPE_APP_MANAGER, GspAppManagerClass))
-#define GSP_IS_APP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSP_TYPE_APP_MANAGER))
-#define GSP_IS_APP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSP_TYPE_APP_MANAGER))
-#define GSP_APP_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSP_TYPE_APP_MANAGER, GspAppManagerClass))
-
-typedef struct _GspAppManager GspAppManager;
-typedef struct _GspAppManagerClass GspAppManagerClass;
-
-typedef struct _GspAppManagerPrivate GspAppManagerPrivate;
+G_DECLARE_DERIVABLE_TYPE (GspAppManager, gsp_app_manager, GSP, APP_MANAGER, GObject)
struct _GspAppManagerClass
{
@@ -54,14 +43,7 @@ struct _GspAppManagerClass
GspApp *app);
};
-struct _GspAppManager
-{
- GObject parent_instance;
-
- GspAppManagerPrivate *priv;
-};
-
-GType gsp_app_manager_get_type (void);
+GType gsp_app_manager_get_type (void) G_GNUC_CONST;
GspAppManager *gsp_app_manager_get (void);
@@ -78,8 +60,6 @@ const char *gsp_app_manager_get_dir (GspAppManager *manager,
void gsp_app_manager_add (GspAppManager *manager,
GspApp *app);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __GSP_APP_MANAGER_H */
diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index 4b299f5..02a91cc 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -48,7 +48,7 @@
#define GSP_ASP_SAVE_MASK_COMMENT 0x0010
#define GSP_ASP_SAVE_MASK_ALL 0xffff
-struct _GspAppPrivate {
+typedef struct {
char *basename;
char *path;
@@ -77,10 +77,7 @@ struct _GspAppPrivate {
/* after writing to file, we skip the next file monitor event of type
* CHANGED */
gboolean skip_next_monitor_event;
-};
-
-#define GSP_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSP_TYPE_APP, GspAppPrivate))
-
+} GspAppPrivate;
enum {
CHANGED,
@@ -91,7 +88,7 @@ enum {
static guint gsp_app_signals[LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (GspApp, gsp_app, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GspApp, gsp_app, G_TYPE_OBJECT)
static void gsp_app_dispose (GObject *object);
static void gsp_app_finalize (GObject *object);
@@ -148,60 +145,64 @@ gsp_app_class_init (GspAppClass *class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- g_type_class_add_private (class, sizeof (GspAppPrivate));
}
static void
gsp_app_init (GspApp *app)
{
- app->priv = GSP_APP_GET_PRIVATE (app);
+ GspAppPrivate *priv;
- memset (app->priv, 0, sizeof (GspAppPrivate));
- app->priv->xdg_position = G_MAXUINT;
- app->priv->xdg_system_position = G_MAXUINT;
+ priv = gsp_app_get_instance_private (app);
+
+ memset (priv, 0, sizeof (GspAppPrivate));
+ priv->xdg_position = G_MAXUINT;
+ priv->xdg_system_position = G_MAXUINT;
}
static void
_gsp_app_free_reusable_data (GspApp *app)
{
- if (app->priv->path) {
- g_free (app->priv->path);
- app->priv->path = NULL;
+ GspAppPrivate *priv;
+
+ priv = gsp_app_get_instance_private (app);
+ if (priv->path) {
+ g_free (priv->path);
+ priv->path = NULL;
}
- if (app->priv->name) {
- g_free (app->priv->name);
- app->priv->name = NULL;
+ if (priv->name) {
+ g_free (priv->name);
+ priv->name = NULL;
}
- if (app->priv->exec) {
- g_free (app->priv->exec);
- app->priv->exec = NULL;
+ if (priv->exec) {
+ g_free (priv->exec);
+ priv->exec = NULL;
}
- if (app->priv->comment) {
- g_free (app->priv->comment);
- app->priv->comment = NULL;
+ if (priv->comment) {
+ g_free (priv->comment);
+ priv->comment = NULL;
}
- if (app->priv->icon) {
- g_free (app->priv->icon);
- app->priv->icon = NULL;
+ if (priv->icon) {
+ g_free (priv->icon);
+ priv->icon = NULL;
}
- if (app->priv->gicon) {
- g_object_unref (app->priv->gicon);
- app->priv->gicon = NULL;
+ if (priv->gicon) {
+ g_object_unref (priv->gicon);
+ priv->gicon = NULL;
}
- if (app->priv->description) {
- g_free (app->priv->description);
- app->priv->description = NULL;
+ if (priv->description) {
+ g_free (priv->description);
+ priv->description = NULL;
}
- if (app->priv->old_system_path) {
- g_free (app->priv->old_system_path);
- app->priv->old_system_path = NULL;
+ if (priv->old_system_path) {
+ g_free (priv->old_system_path);
+ priv->old_system_path = NULL;
}
}
@@ -209,16 +210,18 @@ static void
gsp_app_dispose (GObject *object)
{
GspApp *app;
+ GspAppPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GSP_IS_APP (object));
app = GSP_APP (object);
+ priv = gsp_app_get_instance_private (app);
/* we save in dispose since we might need to reference GspAppManager */
- if (app->priv->save_timeout) {
- g_source_remove (app->priv->save_timeout);
- app->priv->save_timeout = 0;
+ if (priv->save_timeout) {
+ g_source_remove (priv->save_timeout);
+ priv->save_timeout = 0;
/* save now */
_gsp_app_save (app);
@@ -231,15 +234,17 @@ static void
gsp_app_finalize (GObject *object)
{
GspApp *app;
+ GspAppPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (GSP_IS_APP (object));
app = GSP_APP (object);
+ priv = gsp_app_get_instance_private (app);
- if (app->priv->basename) {
- g_free (app->priv->basename);
- app->priv->basename = NULL;
+ if (priv->basename) {
+ g_free (priv->basename);
+ priv->basename = NULL;
}
_gsp_app_free_reusable_data (app);
@@ -264,25 +269,28 @@ _gsp_app_update_description (GspApp *app)
{
const char *primary;
const char *secondary;
+ GspAppPrivate *priv;
- if (!gsm_util_text_is_blank (app->priv->name)) {
- primary = app->priv->name;
- } else if (!gsm_util_text_is_blank (app->priv->exec)) {
- primary = app->priv->exec;
+ priv = gsp_app_get_instance_private (app);
+
+ if (!gsm_util_text_is_blank (priv->name)) {
+ primary = priv->name;
+ } else if (!gsm_util_text_is_blank (priv->exec)) {
+ primary = priv->exec;
} else {
primary = _("No name");
}
- if (!gsm_util_text_is_blank (app->priv->comment)) {
- secondary = app->priv->comment;
+ if (!gsm_util_text_is_blank (priv->comment)) {
+ secondary = priv->comment;
} else {
secondary = _("No description");
}
- g_free (app->priv->description);
- app->priv->description = g_markup_printf_escaped ("<b>%s</b>\n%s",
- primary,
- secondary);
+ g_free (priv->description);
+ priv->description = g_markup_printf_escaped ("<b>%s</b>\n%s",
+ primary,
+ secondary);
}
/*
@@ -305,20 +313,22 @@ _gsp_app_user_equal_system (GspApp *app,
char **system_path)
{
GspAppManager *manager;
+ GspAppPrivate *priv;
const char *system_dir;
char *path;
char *str;
GKeyFile *keyfile;
manager = gsp_app_manager_get ();
+ priv = gsp_app_get_instance_private (app);
system_dir = gsp_app_manager_get_dir (manager,
- app->priv->xdg_system_position);
+ priv->xdg_system_position);
g_object_unref (manager);
if (!system_dir) {
return FALSE;
}
- path = g_build_filename (system_dir, app->priv->basename, NULL);
+ path = g_build_filename (system_dir, priv->basename, NULL);
keyfile = g_key_file_new ();
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL)) {
@@ -329,10 +339,10 @@ _gsp_app_user_equal_system (GspApp *app,
if (gsp_key_file_get_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
- FALSE) != app->priv->hidden ||
+ FALSE) != priv->hidden ||
gsp_key_file_get_boolean (keyfile,
GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
- TRUE) != app->priv->enabled) {
+ TRUE) != priv->enabled) {
g_free (path);
g_key_file_free (keyfile);
return FALSE;
@@ -340,7 +350,7 @@ _gsp_app_user_equal_system (GspApp *app,
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME);
- if (!_gsp_str_equal (str, app->priv->name)) {
+ if (!_gsp_str_equal (str, priv->name)) {
g_free (str);
g_free (path);
g_key_file_free (keyfile);
@@ -350,7 +360,7 @@ _gsp_app_user_equal_system (GspApp *app,
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_COMMENT);
- if (!_gsp_str_equal (str, app->priv->comment)) {
+ if (!_gsp_str_equal (str, priv->comment)) {
g_free (str);
g_free (path);
g_key_file_free (keyfile);
@@ -360,7 +370,7 @@ _gsp_app_user_equal_system (GspApp *app,
str = gsp_key_file_get_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_EXEC);
- if (!_gsp_str_equal (str, app->priv->exec)) {
+ if (!_gsp_str_equal (str, priv->exec)) {
g_free (str);
g_free (path);
g_key_file_free (keyfile);
@@ -370,7 +380,7 @@ _gsp_app_user_equal_system (GspApp *app,
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_ICON);
- if (!_gsp_str_equal (str, app->priv->icon)) {
+ if (!_gsp_str_equal (str, priv->icon)) {
g_free (str);
g_free (path);
g_key_file_free (keyfile);
@@ -388,11 +398,14 @@ _gsp_app_user_equal_system (GspApp *app,
static inline void
_gsp_app_save_done_success (GspApp *app)
{
- app->priv->save_mask = 0;
+ GspAppPrivate *priv;
+
+ priv = gsp_app_get_instance_private (app);
+ priv->save_mask = 0;
- if (app->priv->old_system_path) {
- g_free (app->priv->old_system_path);
- app->priv->old_system_path = NULL;
+ if (priv->old_system_path) {
+ g_free (priv->old_system_path);
+ priv->old_system_path = NULL;
}
}
@@ -403,30 +416,32 @@ _gsp_app_save (gpointer data)
char *use_path;
GKeyFile *keyfile;
GError *error;
+ GspAppPrivate *priv;
app = GSP_APP (data);
+ priv = gsp_app_get_instance_private (app);
/* first check if removing the data from the user dir and using the
* data from the system dir is enough -- this helps us keep clean the
* user config dir by removing unneeded files */
if (_gsp_app_user_equal_system (app, &use_path)) {
- if (g_file_test (app->priv->path, G_FILE_TEST_EXISTS)) {
- g_remove (app->priv->path);
+ if (g_file_test (priv->path, G_FILE_TEST_EXISTS)) {
+ g_remove (priv->path);
}
- g_free (app->priv->path);
- app->priv->path = use_path;
+ g_free (priv->path);
+ priv->path = use_path;
- app->priv->xdg_position = app->priv->xdg_system_position;
+ priv->xdg_position = priv->xdg_system_position;
_gsp_app_save_done_success (app);
return FALSE;
}
- if (app->priv->old_system_path)
- use_path = app->priv->old_system_path;
+ if (priv->old_system_path)
+ use_path = priv->old_system_path;
else
- use_path = app->priv->path;
+ use_path = priv->path;
keyfile = g_key_file_new ();
@@ -440,80 +455,83 @@ _gsp_app_save (gpointer data)
gsp_key_file_populate (keyfile);
}
- if (app->priv->save_mask & GSP_ASP_SAVE_MASK_HIDDEN) {
+ if (priv->save_mask & GSP_ASP_SAVE_MASK_HIDDEN) {
gsp_key_file_set_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
- app->priv->hidden);
+ priv->hidden);
}
- if (app->priv->save_mask & GSP_ASP_SAVE_MASK_ENABLED) {
+ if (priv->save_mask & GSP_ASP_SAVE_MASK_ENABLED) {
gsp_key_file_set_boolean (keyfile,
GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
- app->priv->enabled);
+ priv->enabled);
}
- if (app->priv->save_mask & GSP_ASP_SAVE_MASK_NAME) {
+ if (priv->save_mask & GSP_ASP_SAVE_MASK_NAME) {
gsp_key_file_set_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME,
- app->priv->name);
+ priv->name);
gsp_key_file_ensure_C_key (keyfile, G_KEY_FILE_DESKTOP_KEY_NAME);
}
- if (app->priv->save_mask & GSP_ASP_SAVE_MASK_COMMENT) {
+ if (priv->save_mask & GSP_ASP_SAVE_MASK_COMMENT) {
gsp_key_file_set_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_COMMENT,
- app->priv->comment);
+ priv->comment);
gsp_key_file_ensure_C_key (keyfile, G_KEY_FILE_DESKTOP_KEY_COMMENT);
}
- if (app->priv->save_mask & GSP_ASP_SAVE_MASK_EXEC) {
+ if (priv->save_mask & GSP_ASP_SAVE_MASK_EXEC) {
gsp_key_file_set_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_EXEC,
- app->priv->exec);
+ priv->exec);
}
_gsp_ensure_user_autostart_dir ();
- if (gsp_key_file_to_file (keyfile, app->priv->path, NULL)) {
- app->priv->skip_next_monitor_event = TRUE;
+ if (gsp_key_file_to_file (keyfile, priv->path, NULL)) {
+ priv->skip_next_monitor_event = TRUE;
_gsp_app_save_done_success (app);
} else {
- g_warning ("Could not save %s file", app->priv->path);
+ g_warning ("Could not save %s file", priv->path);
}
g_key_file_free (keyfile);
- app->priv->save_timeout = 0;
+ priv->save_timeout = 0;
return FALSE;
}
static void
_gsp_app_queue_save (GspApp *app)
{
- if (app->priv->save_timeout) {
- g_source_remove (app->priv->save_timeout);
- app->priv->save_timeout = 0;
+ GspAppPrivate *priv;
+
+ priv = gsp_app_get_instance_private (app);
+ if (priv->save_timeout) {
+ g_source_remove (priv->save_timeout);
+ priv->save_timeout = 0;
}
/* if the file was not in the user directory, then we'll create a copy
* there */
- if (app->priv->xdg_position != 0) {
- app->priv->xdg_position = 0;
+ if (priv->xdg_position != 0) {
+ priv->xdg_position = 0;
- if (app->priv->old_system_path == NULL) {
- app->priv->old_system_path = app->priv->path;
+ if (priv->old_system_path == NULL) {
+ priv->old_system_path = priv->path;
/* if old_system_path was not NULL, then it means we
* tried to save and we failed; in that case, we want
* to try again and use the old file as a basis again */
}
- app->priv->path = g_build_filename (g_get_user_config_dir (),
- "autostart",
- app->priv->basename, NULL);
+ priv->path = g_build_filename (g_get_user_config_dir (),
+ "autostart",
+ priv->basename, NULL);
}
- app->priv->save_timeout = g_timeout_add_seconds (GSP_APP_SAVE_DELAY,
- _gsp_app_save,
- app);
+ priv->save_timeout = g_timeout_add_seconds (GSP_APP_SAVE_DELAY,
+ _gsp_app_save,
+ app);
}
/*
@@ -523,47 +541,67 @@ _gsp_app_queue_save (GspApp *app)
const char *
gsp_app_get_basename (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- return app->priv->basename;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->basename;
}
const char *
gsp_app_get_path (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- return app->priv->path;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->path;
}
gboolean
gsp_app_get_hidden (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), FALSE);
- return app->priv->hidden;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->hidden;
}
gboolean
gsp_app_get_enabled (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), FALSE);
- return app->priv->enabled;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->enabled;
}
void
gsp_app_set_enabled (GspApp *app,
gboolean enabled)
{
+ GspAppPrivate *priv;
+
g_return_if_fail (GSP_IS_APP (app));
- if (enabled == app->priv->enabled) {
+ priv = gsp_app_get_instance_private (app);
+
+ if (enabled == priv->enabled) {
return;
}
- app->priv->enabled = enabled;
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_ENABLED;
+ priv->enabled = enabled;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_ENABLED;
_gsp_app_queue_save (app);
_gsp_app_emit_changed (app);
@@ -572,34 +610,50 @@ gsp_app_set_enabled (GspApp *app,
const char *
gsp_app_get_name (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- return app->priv->name;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->name;
}
const char *
gsp_app_get_exec (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- return app->priv->exec;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->exec;
}
const char *
gsp_app_get_comment (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- return app->priv->comment;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->comment;
}
GIcon *
gsp_app_get_icon (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- if (app->priv->gicon) {
- return g_object_ref (app->priv->gicon);
+ priv = gsp_app_get_instance_private (app);
+
+ if (priv->gicon) {
+ return g_object_ref (priv->gicon);
} else {
return NULL;
}
@@ -608,34 +662,50 @@ gsp_app_get_icon (GspApp *app)
unsigned int
gsp_app_get_xdg_position (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), G_MAXUINT);
- return app->priv->xdg_position;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->xdg_position;
}
unsigned int
gsp_app_get_xdg_system_position (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), G_MAXUINT);
- return app->priv->xdg_system_position;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->xdg_system_position;
}
void
gsp_app_set_xdg_system_position (GspApp *app,
unsigned int position)
{
+ GspAppPrivate *priv;
+
g_return_if_fail (GSP_IS_APP (app));
- app->priv->xdg_system_position = position;
+ priv = gsp_app_get_instance_private (app);
+
+ priv->xdg_system_position = position;
}
const char *
gsp_app_get_description (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_val_if_fail (GSP_IS_APP (app), NULL);
- return app->priv->description;
+ priv = gsp_app_get_instance_private (app);
+
+ return priv->description;
}
/*
@@ -649,34 +719,36 @@ gsp_app_update (GspApp *app,
const char *exec)
{
gboolean changed;
+ GspAppPrivate *priv;
g_return_if_fail (GSP_IS_APP (app));
changed = FALSE;
+ priv = gsp_app_get_instance_private (app);
- if (!_gsp_str_equal (name, app->priv->name)) {
+ if (!_gsp_str_equal (name, priv->name)) {
changed = TRUE;
- g_free (app->priv->name);
- app->priv->name = g_strdup (name);
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_NAME;
+ g_free (priv->name);
+ priv->name = g_strdup (name);
+ priv->save_mask |= GSP_ASP_SAVE_MASK_NAME;
}
- if (!_gsp_str_equal (comment, app->priv->comment)) {
+ if (!_gsp_str_equal (comment, priv->comment)) {
changed = TRUE;
- g_free (app->priv->comment);
- app->priv->comment = g_strdup (comment);
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_COMMENT;
+ g_free (priv->comment);
+ priv->comment = g_strdup (comment);
+ priv->save_mask |= GSP_ASP_SAVE_MASK_COMMENT;
}
if (changed) {
_gsp_app_update_description (app);
}
- if (!_gsp_str_equal (exec, app->priv->exec)) {
+ if (!_gsp_str_equal (exec, priv->exec)) {
changed = TRUE;
- g_free (app->priv->exec);
- app->priv->exec = g_strdup (exec);
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_EXEC;
+ g_free (priv->exec);
+ priv->exec = g_strdup (exec);
+ priv->save_mask |= GSP_ASP_SAVE_MASK_EXEC;
}
if (changed) {
@@ -688,30 +760,33 @@ gsp_app_update (GspApp *app,
void
gsp_app_delete (GspApp *app)
{
+ GspAppPrivate *priv;
+
g_return_if_fail (GSP_IS_APP (app));
- if (app->priv->xdg_position == 0 &&
- app->priv->xdg_system_position == G_MAXUINT) {
+ priv = gsp_app_get_instance_private (app);
+ if (priv->xdg_position == 0 &&
+ priv->xdg_system_position == G_MAXUINT) {
/* exists in user directory only */
- if (app->priv->save_timeout) {
- g_source_remove (app->priv->save_timeout);
- app->priv->save_timeout = 0;
+ if (priv->save_timeout) {
+ g_source_remove (priv->save_timeout);
+ priv->save_timeout = 0;
}
- if (g_file_test (app->priv->path, G_FILE_TEST_EXISTS)) {
- g_remove (app->priv->path);
+ if (g_file_test (priv->path, G_FILE_TEST_EXISTS)) {
+ g_remove (priv->path);
}
/* for extra safety */
- app->priv->hidden = TRUE;
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
+ priv->hidden = TRUE;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
_gsp_app_emit_removed (app);
} else {
/* also exists in system directory, so we have to keep a file
* in the user directory */
- app->priv->hidden = TRUE;
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
+ priv->hidden = TRUE;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
_gsp_app_queue_save (app);
_gsp_app_emit_changed (app);
@@ -727,9 +802,13 @@ gsp_app_reload_at (GspApp *app,
const char *path,
unsigned int xdg_position)
{
+ GspAppPrivate *priv;
+
g_return_if_fail (GSP_IS_APP (app));
- app->priv->xdg_position = G_MAXUINT;
+ priv = gsp_app_get_instance_private (app);
+
+ priv->xdg_position = G_MAXUINT;
gsp_app_new (path, xdg_position);
}
@@ -778,34 +857,36 @@ gsp_app_new (const char *path,
GKeyFile *keyfile;
char *basename;
gboolean new;
+ GspAppPrivate *priv;
basename = g_path_get_basename (path);
manager = gsp_app_manager_get ();
app = gsp_app_manager_find_app_with_basename (manager, basename);
+ priv = gsp_app_get_instance_private (app);
g_object_unref (manager);
new = (app == NULL);
if (!new) {
- if (app->priv->xdg_position == xdg_position) {
- if (app->priv->skip_next_monitor_event) {
- app->priv->skip_next_monitor_event = FALSE;
+ if (priv->xdg_position == xdg_position) {
+ if (priv->skip_next_monitor_event) {
+ priv->skip_next_monitor_event = FALSE;
return NULL;
}
/* else: the file got changed but not by us, we'll
* update our data from disk */
}
- if (app->priv->xdg_position < xdg_position ||
- app->priv->save_timeout != 0) {
+ if (priv->xdg_position < xdg_position ||
+ priv->save_timeout != 0) {
/* we don't really care about this file, since we
* already have something with a higher priority, or
* we're going to write something in the user config
* anyway.
* Note: xdg_position >= 1 so it's a system dir */
- app->priv->xdg_system_position = MIN (xdg_position,
- app->priv->xdg_system_position);
+ priv->xdg_system_position = MIN (xdg_position,
+ priv->xdg_system_position);
return NULL;
}
}
@@ -825,49 +906,50 @@ gsp_app_new (const char *path,
if (new) {
app = g_object_new (GSP_TYPE_APP, NULL);
- app->priv->basename = basename;
+ priv = gsp_app_get_instance_private (app);
+ priv->basename = basename;
} else {
g_free (basename);
_gsp_app_free_reusable_data (app);
}
- app->priv->path = g_strdup (path);
+ priv->path = g_strdup (path);
- app->priv->hidden = gsp_key_file_get_boolean (keyfile,
- G_KEY_FILE_DESKTOP_KEY_HIDDEN,
- FALSE);
- app->priv->enabled = gsp_key_file_get_boolean (keyfile,
- GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
- TRUE);
+ priv->hidden = gsp_key_file_get_boolean (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_HIDDEN,
+ FALSE);
+ priv->enabled = gsp_key_file_get_boolean (keyfile,
+ GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
+ TRUE);
- app->priv->name = gsp_key_file_get_locale_string (keyfile,
- G_KEY_FILE_DESKTOP_KEY_NAME);
- app->priv->exec = gsp_key_file_get_string (keyfile,
- G_KEY_FILE_DESKTOP_KEY_EXEC);
- app->priv->comment = gsp_key_file_get_locale_string (keyfile,
- G_KEY_FILE_DESKTOP_KEY_COMMENT);
+ priv->name = gsp_key_file_get_locale_string (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_NAME);
+ priv->exec = gsp_key_file_get_string (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_EXEC);
+ priv->comment = gsp_key_file_get_locale_string (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_COMMENT);
- if (gsm_util_text_is_blank (app->priv->name)) {
- g_free (app->priv->name);
- app->priv->name = g_strdup (app->priv->exec);
+ if (gsm_util_text_is_blank (priv->name)) {
+ g_free (priv->name);
+ priv->name = g_strdup (priv->exec);
}
- app->priv->icon = gsp_key_file_get_locale_string (keyfile,
- G_KEY_FILE_DESKTOP_KEY_ICON);
+ priv->icon = gsp_key_file_get_locale_string (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_ICON);
- if (app->priv->icon) {
+ if (priv->icon) {
/* look at icon and see if it's a themed icon or not */
- if (g_path_is_absolute (app->priv->icon)) {
+ if (g_path_is_absolute (priv->icon)) {
GFile *iconfile;
- iconfile = g_file_new_for_path (app->priv->icon);
- app->priv->gicon = g_file_icon_new (iconfile);
+ iconfile = g_file_new_for_path (priv->icon);
+ priv->gicon = g_file_icon_new (iconfile);
g_object_unref (iconfile);
} else {
- app->priv->gicon = g_themed_icon_new (app->priv->icon);
+ priv->gicon = g_themed_icon_new (priv->icon);
}
} else {
- app->priv->gicon = NULL;
+ priv->gicon = NULL;
}
g_key_file_free (keyfile);
@@ -875,16 +957,16 @@ gsp_app_new (const char *path,
_gsp_app_update_description (app);
if (xdg_position > 0) {
- g_assert (xdg_position <= app->priv->xdg_system_position);
- app->priv->xdg_system_position = xdg_position;
+ g_assert (xdg_position <= priv->xdg_system_position);
+ priv->xdg_system_position = xdg_position;
}
/* else we keep the old value (which is G_MAXUINT if it wasn't set) */
- app->priv->xdg_position = xdg_position;
+ priv->xdg_position = xdg_position;
- g_assert (!new || app->priv->save_timeout == 0);
- app->priv->save_timeout = 0;
- app->priv->old_system_path = NULL;
- app->priv->skip_next_monitor_event = FALSE;
+ g_assert (!new || priv->save_timeout == 0);
+ priv->save_timeout = 0;
+ priv->old_system_path = NULL;
+ priv->skip_next_monitor_event = FALSE;
if (!new) {
_gsp_app_emit_changed (app);
@@ -956,6 +1038,7 @@ gsp_app_create (const char *name,
const char *exec)
{
GspAppManager *manager;
+ GspAppPrivate *priv;
GspApp *app;
char *basename;
char **argv;
@@ -974,35 +1057,36 @@ gsp_app_create (const char *name,
}
app = g_object_new (GSP_TYPE_APP, NULL);
+ priv = gsp_app_get_instance_private (app);
- app->priv->basename = basename;
- app->priv->path = g_build_filename (g_get_user_config_dir (),
- "autostart",
- app->priv->basename, NULL);
+ priv->basename = basename;
+ priv->path = g_build_filename (g_get_user_config_dir (),
+ "autostart",
+ priv->basename, NULL);
- app->priv->hidden = FALSE;
- app->priv->enabled = TRUE;
+ priv->hidden = FALSE;
+ priv->enabled = TRUE;
if (!gsm_util_text_is_blank (name)) {
- app->priv->name = g_strdup (name);
+ priv->name = g_strdup (name);
} else {
- app->priv->name = g_strdup (exec);
+ priv->name = g_strdup (exec);
}
- app->priv->exec = g_strdup (exec);
- app->priv->comment = g_strdup (comment);
- app->priv->icon = NULL;
+ priv->exec = g_strdup (exec);
+ priv->comment = g_strdup (comment);
+ priv->icon = NULL;
- app->priv->gicon = NULL;
+ priv->gicon = NULL;
_gsp_app_update_description (app);
/* by definition */
- app->priv->xdg_position = 0;
- app->priv->xdg_system_position = G_MAXUINT;
+ priv->xdg_position = 0;
+ priv->xdg_system_position = G_MAXUINT;
- app->priv->save_timeout = 0;
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_ALL;
- app->priv->old_system_path = NULL;
- app->priv->skip_next_monitor_event = FALSE;
+ priv->save_timeout = 0;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_ALL;
+ priv->old_system_path = NULL;
+ priv->skip_next_monitor_event = FALSE;
_gsp_app_queue_save (app);
@@ -1016,6 +1100,7 @@ gboolean
gsp_app_copy_desktop_file (const char *uri)
{
GspAppManager *manager;
+ GspAppPrivate *priv;
GspApp *app;
GFile *src_file;
char *src_basename;
@@ -1062,6 +1147,7 @@ gsp_app_copy_desktop_file (const char *uri)
g_object_unref (dst_file);
app = gsp_app_new (dst_path, 0);
+ priv = gsp_app_get_instance_private (app);
if (!app) {
g_remove (dst_path);
g_free (dst_path);
@@ -1071,16 +1157,16 @@ gsp_app_copy_desktop_file (const char *uri)
g_free (dst_path);
changed = FALSE;
- if (app->priv->hidden) {
+ if (priv->hidden) {
changed = TRUE;
- app->priv->hidden = FALSE;
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
+ priv->hidden = FALSE;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
}
- if (!app->priv->enabled) {
+ if (!priv->enabled) {
changed = TRUE;
- app->priv->enabled = TRUE;
- app->priv->save_mask |= GSP_ASP_SAVE_MASK_ENABLED;
+ priv->enabled = TRUE;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_ENABLED;
}
if (changed) {
diff --git a/capplet/gsp-app.h b/capplet/gsp-app.h
index b72db13..3525d9f 100644
--- a/capplet/gsp-app.h
+++ b/capplet/gsp-app.h
@@ -27,21 +27,10 @@
#include <glib-object.h>
#include <gio/gio.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define GSP_TYPE_APP (gsp_app_get_type ())
-#define GSP_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSP_TYPE_APP, GspApp))
-#define GSP_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSP_TYPE_APP, GspAppClass))
-#define GSP_IS_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSP_TYPE_APP))
-#define GSP_IS_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSP_TYPE_APP))
-#define GSP_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSP_TYPE_APP, GspAppClass))
-
-typedef struct _GspApp GspApp;
-typedef struct _GspAppClass GspAppClass;
-
-typedef struct _GspAppPrivate GspAppPrivate;
+G_DECLARE_DERIVABLE_TYPE (GspApp, gsp_app, GSP, APP, GObject)
struct _GspAppClass
{
@@ -51,14 +40,7 @@ struct _GspAppClass
void (* removed) (GspApp *app);
};
-struct _GspApp
-{
- GObject parent_instance;
-
- GspAppPrivate *priv;
-};
-
-GType gsp_app_get_type (void);
+GType gsp_app_get_type (void) G_GNUC_CONST;
void gsp_app_create (const char *name,
const char *comment,
@@ -102,8 +84,6 @@ unsigned int gsp_app_get_xdg_system_position (GspApp *app);
void gsp_app_set_xdg_system_position (GspApp *app,
unsigned int position);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* __GSP_APP_H */