summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac9
-rw-r--r--libslab/app-shell.c45
-rw-r--r--shell/control-center.c73
-rw-r--r--shell/matecc.desktop.in.in2
4 files changed, 113 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index 8dcb34f5..4b2df496 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,6 @@ case "$with_gtk" in
GTK_REQUIRED=3.0.0
MATE_DESKTOP_REQUIRED=1.15.1
LIBCANBERRA_API_VERSION=3
- LIBUNIQUE_API_VERSION=3.0
ENGINES_FOLDER="theming-engines"
APPINDICATOR_API_VERSION=3
;;
@@ -160,7 +159,13 @@ COMMON_MODULES="gtk+-$GTK_API_VERSION >= $GTK_REQUIRED dnl
mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED"
PKG_CHECK_MODULES(CAPPLET, $COMMON_MODULES)
PKG_CHECK_MODULES(MATECC, $COMMON_MODULES libmate-menu >= 1.1.0)
-PKG_CHECK_MODULES(MATECC_SHELL, $COMMON_MODULES libmate-menu unique-$LIBUNIQUE_API_VERSION)
+
+if test "$GTK_API_VERSION" = "3.0"; then
+ PKG_CHECK_MODULES(MATECC_SHELL, $COMMON_MODULES libmate-menu)
+else
+ PKG_CHECK_MODULES(MATECC_SHELL, $COMMON_MODULES libmate-menu unique-$LIBUNIQUE_API_VERSION)
+fi
+
PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= MATE_DESKTOP_REQUIRED)
PKG_CHECK_MODULES(DEFAULT_APPLICATIONS_CAPPLET, libxml-2.0)
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 9e84e1c5..41fb3419 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -195,6 +195,9 @@ launch_selected_app (AppShellData * app_data)
static gboolean
main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData * app_data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
if (event->keyval == GDK_KEY_Return)
{
SlabSection *section = SLAB_SECTION (app_data->filter_section);
@@ -216,7 +219,14 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
((event->keyval == GDK_KEY_q || event->keyval == GDK_KEY_Q) && (event->state & GDK_CONTROL_MASK)))
{
if (app_data->exit_on_close)
+#if GTK_CHECK_VERSION(3,0,0)
+ {
+ app=g_application_get_default();
+ g_application_quit(app);
+ }
+#else
gtk_main_quit ();
+#endif
else
hide_shell (app_data);
return TRUE;
@@ -227,9 +237,18 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
static gboolean
main_delete_callback (GtkWidget * widget, GdkEvent * event, AppShellData * app_data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
if (app_data->exit_on_close)
{
- gtk_main_quit ();
+ /*avoid "gtk_main_quit: assertion 'main_loops != NULL' failed" critical here */
+#if GTK_CHECK_VERSION(3,0,0)
+ app=g_application_get_default();
+ g_application_quit(app);
+#else
+ gtk_main_quit();
+#endif
return FALSE;
}
@@ -1385,6 +1404,9 @@ tile_activated_cb (Tile * tile, TileEvent * event, gpointer user_data)
static void
handle_launcher_single_clicked (Tile * launcher, gpointer data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
AppShellData *app_data = (AppShellData *) data;
tile_trigger_action (launcher, launcher->actions[APPLICATION_TILE_ACTION_START]);
@@ -1392,7 +1414,14 @@ handle_launcher_single_clicked (Tile * launcher, gpointer data)
if (g_settings_get_boolean (app_data->settings, EXIT_SHELL_ON_ACTION_START))
{
if (app_data->exit_on_close)
- gtk_main_quit ();
+#if GTK_CHECK_VERSION(3,0,0)
+ {
+ app=g_application_get_default();
+ g_application_quit(app);
+ }
+#else
+ gtk_main_quit();
+#endif
else
hide_shell (app_data);
}
@@ -1402,6 +1431,9 @@ static void
handle_menu_action_performed (Tile * launcher, TileEvent * event, TileAction * action,
gpointer data)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
AppShellData *app_data = (AppShellData *) data;
gchar *temp;
@@ -1433,7 +1465,14 @@ handle_menu_action_performed (Tile * launcher, TileEvent * event, TileAction * a
if (g_settings_get_boolean (app_data->settings, temp))
{
if (app_data->exit_on_close)
- gtk_main_quit ();
+#if GTK_CHECK_VERSION(3,0,0)
+ {
+ app=g_application_get_default();
+ g_application_quit(app);
+ }
+#else
+ gtk_main_quit();
+#endif
else
hide_shell (app_data);
}
diff --git a/shell/control-center.c b/shell/control-center.c
index 2f1454b2..d0f8f8cb 100644
--- a/shell/control-center.c
+++ b/shell/control-center.c
@@ -23,8 +23,9 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
+#if !GTK_CHECK_VERSION(3,0,0)
#include <unique/unique.h>
-
+#endif
#include <libslab/slab.h>
void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data);
@@ -93,7 +94,9 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
AppShellData* app_data = (AppShellData*) data;
MateDesktopItem* item = (MateDesktopItem*) g_object_get_data(G_OBJECT(tile), APP_ACTION_KEY);
GSettings *settings;
-
+#if GTK_CHECK_VERSION(3,0,0)
+ GApplication *app;
+#endif
if (event->type == TILE_EVENT_ACTIVATED_DOUBLE_CLICK)
{
return;
@@ -107,7 +110,12 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
{
if (app_data->exit_on_close)
{
+#if GTK_CHECK_VERSION(3,0,0)
+ app=g_application_get_default();
+ g_application_quit(app);
+#else
gtk_main_quit();
+#endif
}
else
{
@@ -118,6 +126,40 @@ void handle_static_action_clicked(Tile* tile, TileEvent* event, gpointer data)
g_object_unref(settings);
}
+#if GTK_CHECK_VERSION(3,0,0)
+static void
+activate (GtkApplication *app)
+{
+ GList *list;
+ GSList* actions;
+ gboolean hidden = FALSE;
+
+ list = gtk_application_get_windows (app);
+
+ AppShellData* app_data = appshelldata_new("matecc.menu", GTK_ICON_SIZE_DND, FALSE, TRUE, 0);
+
+ generate_categories(app_data);
+
+ actions = get_actions_list();
+ layout_shell(app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions, handle_static_action_clicked);
+
+ if (list)
+ {
+ gtk_window_present (GTK_WINDOW (list->data));
+ }
+ else
+ {
+ create_main_window(app_data, "MyControlCenter", _("Control Center"), "preferences-desktop", 975, 600, hidden);
+ gtk_application_add_window (app, GTK_WINDOW(app_data->main_app));
+ }
+}
+
+static void
+quit (GApplication *app)
+{
+ g_application_quit(app);
+}
+#else
static UniqueResponse message_received_cb(UniqueApp* app, UniqueCommand command, UniqueMessageData* message, guint time, gpointer user_data)
{
UniqueResponse res;
@@ -148,24 +190,30 @@ static UniqueResponse message_received_cb(UniqueApp* app, UniqueCommand command,
return res;
}
-
+#endif
int main(int argc, char* argv[])
{
gboolean hidden = FALSE;
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkApplication *app;
+ gint retval;
+ app = gtk_application_new ("org.mate.mate-control-center.shell", 0);
+#else
UniqueApp* unique_app;
AppShellData* app_data;
GSList* actions;
+#endif
GError* error;
GOptionEntry options[] = {
{"hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL},
{NULL}
};
- #ifdef ENABLE_NLS
- bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
- bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
- textdomain(GETTEXT_PACKAGE);
- #endif
+#ifdef ENABLE_NLS
+ bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR);
+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+#endif
error = NULL;
@@ -175,7 +223,12 @@ int main(int argc, char* argv[])
g_error_free(error);
return 1;
}
-
+#if GTK_CHECK_VERSION(3,0,0)
+ g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
+ g_signal_connect (app, "window-removed", G_CALLBACK (quit), NULL);
+ retval = g_application_run (G_APPLICATION (app), argc, argv);
+ return retval;
+#else
unique_app = unique_app_new("org.mate.mate-control-center.shell", NULL);
if (unique_app_is_running(unique_app))
@@ -205,8 +258,8 @@ int main(int argc, char* argv[])
g_signal_connect(unique_app, "message-received", G_CALLBACK(message_received_cb), app_data);
gtk_main();
-
g_object_unref(unique_app);
return 0;
+#endif
}
diff --git a/shell/matecc.desktop.in.in b/shell/matecc.desktop.in.in
index 50480c63..ca3298e9 100644
--- a/shell/matecc.desktop.in.in
+++ b/shell/matecc.desktop.in.in
@@ -5,7 +5,7 @@ Icon=preferences-desktop
Exec=mate-control-center
Terminal=false
Type=Application
-StartupNotify=true
+StartupNotify=false
Categories=GTK;Settings;
Keywords=MATE;control;center;configuration;tool;destop;preferences;
OnlyShowIn=MATE;