diff options
author | monsta <[email protected]> | 2016-12-02 00:45:36 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2016-12-02 00:50:14 +0300 |
commit | 0c27d18ab5efb721a2f02549767016c81fc6ce2c (patch) | |
tree | 76b7b89cface072e011a3757a833e9090bab44f2 /shell | |
parent | 1aa83d45ebf9599c6d4d3f47211c3961282e98f0 (diff) | |
download | mate-control-center-0c27d18ab5efb721a2f02549767016c81fc6ce2c.tar.bz2 mate-control-center-0c27d18ab5efb721a2f02549767016c81fc6ce2c.tar.xz |
move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option
and require libmatekbd, libmate-desktop, marco, m-s-d >= 1.17
Diffstat (limited to 'shell')
-rw-r--r-- | shell/control-center.c | 84 |
1 files changed, 2 insertions, 82 deletions
diff --git a/shell/control-center.c b/shell/control-center.c index d0f8f8cb..55c4246d 100644 --- a/shell/control-center.c +++ b/shell/control-center.c @@ -23,9 +23,6 @@ #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); @@ -94,9 +91,8 @@ 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; @@ -110,12 +106,8 @@ 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 { @@ -126,7 +118,6 @@ 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) { @@ -159,50 +150,13 @@ 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; - AppShellData* app_data = user_data; - - switch (command) - { - case UNIQUE_ACTIVATE: - /* move the main window to the screen that sent us the command */ - gtk_window_set_screen(GTK_WINDOW(app_data->main_app), unique_message_data_get_screen(message)); - - if (!app_data->main_app_window_shown_once) - { - show_shell(app_data); - } - - gtk_window_present_with_time(GTK_WINDOW(app_data->main_app), time); - gtk_widget_grab_focus(SLAB_SECTION(app_data->filter_section)->contents); - - res = UNIQUE_RESPONSE_OK; - - break; - default: - res = UNIQUE_RESPONSE_PASSTHROUGH; - break; - } - - 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}, @@ -223,43 +177,9 @@ 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)) - { - int retval = 0; - - if (!hidden) - { - UniqueResponse response; - response = unique_app_send_message(unique_app, UNIQUE_ACTIVATE, NULL); - retval = (response != UNIQUE_RESPONSE_OK); - } - - g_object_unref(unique_app); - return retval; - } - - 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); - - create_main_window(app_data, "MyControlCenter", _("Control Center"), "preferences-desktop", 975, 600, hidden); - - unique_app_watch_window(unique_app, GTK_WINDOW(app_data->main_app)); - g_signal_connect(unique_app, "message-received", G_CALLBACK(message_received_cb), app_data); - - gtk_main(); - g_object_unref(unique_app); - - return 0; -#endif } |