2006-11-13 08:33:07 +00:00
/*
2013-02-16 21:56:16 -05:00
* Copyright © 2013 Red Hat , Inc .
2006-11-13 08:33:07 +00:00
*
2013-02-16 21:56:16 -05:00
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
2006-11-13 08:33:07 +00:00
*
2013-02-16 21:56:16 -05:00
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
2006-11-13 08:33:07 +00:00
*
2013-02-16 21:56:16 -05:00
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA
* 02110 - 1301 , USA .
2006-11-13 08:33:07 +00:00
*/
# include "config.h"
2010-12-02 19:17:38 +00:00
# include <stdlib.h>
2010-05-24 22:48:34 +01:00
2013-02-16 21:56:16 -05:00
# include <glib.h>
# include <glib/gi18n.h>
# include <gio/gio.h>
2021-10-19 20:57:26 -03:00
# include <adwaita.h>
2006-11-13 08:33:07 +00:00
2013-02-16 21:56:16 -05:00
# include "cc-application.h"
2018-04-06 23:18:26 -03:00
# include "cc-log.h"
2018-03-27 17:48:08 -03:00
# include "cc-object-storage.h"
2013-02-16 21:56:16 -05:00
# include "cc-panel-loader.h"
2013-02-17 00:54:58 -05:00
# include "cc-window.h"
2012-02-17 12:46:45 +01:00
2018-01-21 10:31:07 -02:00
struct _CcApplication
2013-02-16 21:56:16 -05:00
{
2021-10-19 20:57:26 -03:00
AdwApplication parent ;
2018-01-21 10:31:07 -02:00
2018-04-08 17:13:42 -03:00
CcShellModel * model ;
2018-01-21 10:31:07 -02:00
CcWindow * window ;
2013-02-16 21:56:16 -05:00
} ;
2018-03-06 22:48:06 -03:00
static void cc_application_quit ( GSimpleAction * simple ,
GVariant * parameter ,
gpointer user_data ) ;
static void launch_panel_activated ( GSimpleAction * action ,
GVariant * parameter ,
gpointer user_data ) ;
static void help_activated ( GSimpleAction * action ,
GVariant * parameter ,
gpointer user_data ) ;
2023-11-29 17:30:33 +01:00
static void about_activated ( GSimpleAction * action ,
GVariant * parameter ,
gpointer user_data ) ;
2021-06-07 17:41:23 +05:30
static gboolean cmd_verbose_cb ( const char * option_name ,
const char * value ,
gpointer data ,
GError * * error ) ;
2021-10-19 20:57:26 -03:00
G_DEFINE_TYPE ( CcApplication , cc_application , ADW_TYPE_APPLICATION )
2011-03-22 16:46:55 +00:00
2010-12-02 19:17:38 +00:00
const GOptionEntry all_options [ ] = {
2015-06-20 21:05:20 +02:00
{ " version " , 0 , 0 , G_OPTION_ARG_NONE , NULL , N_ ( " Display version number " ) , NULL } ,
2024-05-05 12:34:18 +05:30
{ " verbose " , ' v ' , G_OPTION_FLAG_NO_ARG , G_OPTION_ARG_CALLBACK , cmd_verbose_cb , N_ ( " Enable verbose mode. Specify multiple times to increase verbosity " ) , NULL } ,
2015-06-20 15:20:15 +02:00
{ " search " , ' s ' , 0 , G_OPTION_ARG_STRING , NULL , N_ ( " Search for the string " ) , " SEARCH " } ,
{ " list " , ' l ' , 0 , G_OPTION_ARG_NONE , NULL , N_ ( " List possible panel names and exit " ) , NULL } ,
{ G_OPTION_REMAINING , ' \0 ' , 0 , G_OPTION_ARG_FILENAME_ARRAY , NULL , N_ ( " Panel to display " ) , N_ ( " [PANEL] [ARGUMENT…] " ) } ,
2012-02-08 13:51:30 +11:00
{ NULL , 0 , 0 , 0 , NULL , NULL , NULL } /* end the list */
2010-12-02 19:17:38 +00:00
} ;
2010-10-22 14:08:11 +01:00
2018-03-06 22:48:06 -03:00
static const GActionEntry cc_app_actions [ ] = {
{ " launch-panel " , launch_panel_activated , " (sav) " , NULL , NULL , { 0 } } ,
{ " help " , help_activated , NULL , NULL , NULL , { 0 } } ,
2023-11-29 17:30:33 +01:00
{ " quit " , cc_application_quit , NULL , NULL , NULL , { 0 } } ,
{ " about " , about_activated , NULL , NULL , NULL , { 0 } }
2018-03-06 22:48:06 -03:00
} ;
2013-02-16 21:56:16 -05:00
static void
help_activated ( GSimpleAction * action ,
GVariant * parameter ,
gpointer user_data )
{
CcApplication * self = CC_APPLICATION ( user_data ) ;
CcPanel * panel ;
GtkWidget * window ;
const char * uri = NULL ;
2018-01-21 10:31:07 -02:00
panel = cc_shell_get_active_panel ( CC_SHELL ( self - > window ) ) ;
2013-02-16 21:56:16 -05:00
if ( panel )
uri = cc_panel_get_help_uri ( panel ) ;
2018-01-21 10:31:07 -02:00
window = cc_shell_get_toplevel ( CC_SHELL ( self - > window ) ) ;
2021-10-19 20:57:26 -03:00
gtk_show_uri ( GTK_WINDOW ( window ) ,
uri ? uri : " help:gnome-help/prefs " ,
GDK_CURRENT_TIME ) ;
2013-02-16 21:56:16 -05:00
}
2023-11-29 17:30:33 +01:00
static void
about_activated ( GSimpleAction * action ,
GVariant * parameter ,
gpointer user_data )
{
CcApplication * self = CC_APPLICATION ( user_data ) ;
2024-03-26 22:05:31 -03:00
AdwDialog * about_dialog ;
2023-12-21 15:11:22 -05:00
const char * developer_name ;
2023-11-29 17:30:33 +01:00
2024-03-26 22:05:31 -03:00
about_dialog = adw_about_dialog_new_from_appdata ( " /org/gnome/Settings/appdata " , NULL ) ;
adw_about_dialog_set_version ( ADW_ABOUT_DIALOG ( about_dialog ) , VERSION ) ;
developer_name = adw_about_dialog_get_developer_name ( ADW_ABOUT_DIALOG ( about_dialog ) ) ;
2023-11-29 17:39:28 +01:00
/* Translators should localize the following string which will be displayed in the About dialog giving credit to the translator(s). */
2024-03-26 22:05:31 -03:00
adw_about_dialog_set_translator_credits ( ADW_ABOUT_DIALOG ( about_dialog ) , _ ( " translator-credits " ) ) ;
adw_about_dialog_set_copyright ( ADW_ABOUT_DIALOG ( about_dialog ) , g_strdup_printf ( _ ( " © 1998 %s " ) , developer_name ) ) ;
2023-11-29 17:39:11 +01:00
2024-03-26 22:05:31 -03:00
adw_dialog_present ( about_dialog , GTK_WIDGET ( self - > window ) ) ;
2023-11-29 17:30:33 +01:00
}
2021-06-07 17:41:23 +05:30
static gboolean
cmd_verbose_cb ( const char * option_name ,
const char * value ,
gpointer data ,
GError * * error )
{
cc_log_increase_verbosity ( ) ;
return TRUE ;
}
shell: Expose panel launching with DBus-activation
Turn Control Center in a DBus-activable service and export a
'launch-panel' GAction which accepts a tuple containing the id of the
desired panel and its parameters as a GVariant array.
The snippet below show how the custom shortcuts section of the keyboard
panel can be invoked by a external programs through DBus:
GVariantBuilder *flags = g_variant_builder_new (G_VARIANT_TYPE_VARDICT);
GVariantBuilder *params = g_variant_builder_new (G_VARIANT_TYPE ("av"));
g_variant_builder_add (params, "v", g_variant_builder_end (flags));
g_variant_builder_add (params, "v", g_variant_new_string ("shortcuts"));
g_variant_builder_add (params, "v", g_variant_new_string ("custom"));
GVariant *v = g_variant_new ("(s@av)", "keyboard", g_variant_builder_end (params));
GApplication *gnomecc = g_application_new (id, G_APPLICATION_IS_LAUNCHER);
if (!g_application_register (gnomecc, NULL, &error))
g_error ("Failed to register launcher for %s: %s", id, error->message);
g_action_group_activate_action (G_ACTION_GROUP (gnomecc), "launch-panel", v);
https://bugzilla.gnome.org/show_bug.cgi?id=696054
2013-03-01 11:45:04 +01:00
static void
launch_panel_activated ( GSimpleAction * action ,
GVariant * parameter ,
gpointer user_data )
{
CcApplication * self = CC_APPLICATION ( user_data ) ;
2019-11-08 09:42:10 +13:00
g_autoptr ( GVariant ) parameters = NULL ;
g_autoptr ( GError ) error = NULL ;
shell: Expose panel launching with DBus-activation
Turn Control Center in a DBus-activable service and export a
'launch-panel' GAction which accepts a tuple containing the id of the
desired panel and its parameters as a GVariant array.
The snippet below show how the custom shortcuts section of the keyboard
panel can be invoked by a external programs through DBus:
GVariantBuilder *flags = g_variant_builder_new (G_VARIANT_TYPE_VARDICT);
GVariantBuilder *params = g_variant_builder_new (G_VARIANT_TYPE ("av"));
g_variant_builder_add (params, "v", g_variant_builder_end (flags));
g_variant_builder_add (params, "v", g_variant_new_string ("shortcuts"));
g_variant_builder_add (params, "v", g_variant_new_string ("custom"));
GVariant *v = g_variant_new ("(s@av)", "keyboard", g_variant_builder_end (params));
GApplication *gnomecc = g_application_new (id, G_APPLICATION_IS_LAUNCHER);
if (!g_application_register (gnomecc, NULL, &error))
g_error ("Failed to register launcher for %s: %s", id, error->message);
g_action_group_activate_action (G_ACTION_GROUP (gnomecc), "launch-panel", v);
https://bugzilla.gnome.org/show_bug.cgi?id=696054
2013-03-01 11:45:04 +01:00
gchar * panel_id ;
g_variant_get ( parameter , " (&s@av) " , & panel_id , & parameters ) ;
2018-03-06 22:05:03 -03:00
shell: Expose panel launching with DBus-activation
Turn Control Center in a DBus-activable service and export a
'launch-panel' GAction which accepts a tuple containing the id of the
desired panel and its parameters as a GVariant array.
The snippet below show how the custom shortcuts section of the keyboard
panel can be invoked by a external programs through DBus:
GVariantBuilder *flags = g_variant_builder_new (G_VARIANT_TYPE_VARDICT);
GVariantBuilder *params = g_variant_builder_new (G_VARIANT_TYPE ("av"));
g_variant_builder_add (params, "v", g_variant_builder_end (flags));
g_variant_builder_add (params, "v", g_variant_new_string ("shortcuts"));
g_variant_builder_add (params, "v", g_variant_new_string ("custom"));
GVariant *v = g_variant_new ("(s@av)", "keyboard", g_variant_builder_end (params));
GApplication *gnomecc = g_application_new (id, G_APPLICATION_IS_LAUNCHER);
if (!g_application_register (gnomecc, NULL, &error))
g_error ("Failed to register launcher for %s: %s", id, error->message);
g_action_group_activate_action (G_ACTION_GROUP (gnomecc), "launch-panel", v);
https://bugzilla.gnome.org/show_bug.cgi?id=696054
2013-03-01 11:45:04 +01:00
g_debug ( " gnome-control-center: 'launch-panel' activated for panel '%s' with % " G_GSIZE_FORMAT " arguments " ,
2018-03-06 22:05:03 -03:00
panel_id ,
g_variant_n_children ( parameters ) ) ;
2018-01-21 10:31:07 -02:00
if ( ! cc_shell_set_active_panel_from_id ( CC_SHELL ( self - > window ) , panel_id , parameters , & error ) )
2018-03-06 22:05:03 -03:00
g_warning ( " Failed to activate the '%s' panel: %s " , panel_id , error - > message ) ;
2014-01-10 15:45:07 -08:00
/* Now present the window */
g_application_activate ( G_APPLICATION ( self ) ) ;
shell: Expose panel launching with DBus-activation
Turn Control Center in a DBus-activable service and export a
'launch-panel' GAction which accepts a tuple containing the id of the
desired panel and its parameters as a GVariant array.
The snippet below show how the custom shortcuts section of the keyboard
panel can be invoked by a external programs through DBus:
GVariantBuilder *flags = g_variant_builder_new (G_VARIANT_TYPE_VARDICT);
GVariantBuilder *params = g_variant_builder_new (G_VARIANT_TYPE ("av"));
g_variant_builder_add (params, "v", g_variant_builder_end (flags));
g_variant_builder_add (params, "v", g_variant_new_string ("shortcuts"));
g_variant_builder_add (params, "v", g_variant_new_string ("custom"));
GVariant *v = g_variant_new ("(s@av)", "keyboard", g_variant_builder_end (params));
GApplication *gnomecc = g_application_new (id, G_APPLICATION_IS_LAUNCHER);
if (!g_application_register (gnomecc, NULL, &error))
g_error ("Failed to register launcher for %s: %s", id, error->message);
g_action_group_activate_action (G_ACTION_GROUP (gnomecc), "launch-panel", v);
https://bugzilla.gnome.org/show_bug.cgi?id=696054
2013-03-01 11:45:04 +01:00
}
2023-11-09 10:08:32 +01:00
static char * *
get_current_desktops ( void )
{
const char * envvar ;
envvar = g_getenv ( " XDG_CURRENT_DESKTOP " ) ;
if ( ! envvar )
return g_new0 ( char * , 0 + 1 ) ;
return g_strsplit ( envvar , G_SEARCHPATH_SEPARATOR_S , 0 ) ;
}
static gboolean
is_supported_desktop ( void )
{
g_auto ( GStrv ) desktops = NULL ;
guint i ;
desktops = get_current_desktops ( ) ;
for ( i = 0 ; desktops [ i ] ! = NULL ; i + + )
{
/* This matches OnlyShowIn in gnome-control-center.desktop.in.in */
if ( g_ascii_strcasecmp ( desktops [ i ] , " GNOME " ) = = 0 )
return TRUE ;
}
return FALSE ;
}
2015-06-23 16:54:42 +02:00
static gint
2018-01-21 10:31:07 -02:00
cc_application_handle_local_options ( GApplication * application ,
GVariantDict * options )
2015-06-23 16:54:42 +02:00
{
2015-06-20 21:05:20 +02:00
if ( g_variant_dict_contains ( options , " version " ) )
{
2023-11-09 10:08:32 +01:00
g_print ( " Local options %s %s \n " , PACKAGE , VERSION ) ;
2015-06-20 21:05:20 +02:00
return 0 ;
}
2023-11-09 10:08:32 +01:00
if ( ! is_supported_desktop ( ) )
{
g_printerr ( " Running gnome-control-center is only supported under GNOME and Unity, exiting \n " ) ;
return 1 ;
}
2015-06-20 15:27:14 +02:00
if ( g_variant_dict_contains ( options , " list " ) )
{
2018-11-07 20:25:30 -02:00
cc_panel_loader_list_panels ( ) ;
2015-06-20 15:27:14 +02:00
return 0 ;
}
2015-06-23 16:54:42 +02:00
return - 1 ;
}
2010-10-29 15:55:40 +01:00
static int
2018-01-21 10:31:07 -02:00
cc_application_command_line ( GApplication * application ,
2013-02-16 21:56:16 -05:00
GApplicationCommandLine * command_line )
2009-08-08 15:07:16 +02:00
{
2018-03-06 22:05:03 -03:00
CcApplication * self ;
g_autofree GStrv start_panels = NULL ;
2015-06-20 15:20:15 +02:00
GVariantDict * options ;
2010-10-29 15:55:40 +01:00
int retval = 0 ;
2015-06-20 15:20:15 +02:00
char * search_str ;
gboolean debug ;
2011-04-07 21:18:06 -04:00
2018-03-06 22:05:03 -03:00
self = CC_APPLICATION ( application ) ;
2015-06-20 15:20:15 +02:00
options = g_application_command_line_get_options_dict ( command_line ) ;
2010-12-02 19:17:38 +00:00
2015-06-20 15:20:15 +02:00
debug = g_variant_dict_contains ( options , " verbose " ) ;
2018-04-06 23:18:26 -03:00
if ( debug )
cc_log_init ( ) ;
2011-03-22 16:46:55 +00:00
2018-01-21 10:31:07 -02:00
gtk_window_present ( GTK_WINDOW ( self - > window ) ) ;
2010-11-19 15:08:23 -05:00
2015-06-20 15:20:15 +02:00
if ( g_variant_dict_lookup ( options , " search " , " &s " , & search_str ) )
2013-01-07 18:10:48 +01:00
{
2018-01-21 10:31:07 -02:00
cc_window_set_search_item ( self - > window , search_str ) ;
2013-01-07 18:10:48 +01:00
}
2015-06-20 15:20:15 +02:00
else if ( g_variant_dict_lookup ( options , G_OPTION_REMAINING , " ^a&ay " , & start_panels ) )
2010-05-19 11:11:26 +01:00
{
2010-12-02 19:17:38 +00:00
const char * start_id ;
2010-05-19 11:11:26 +01:00
GError * err = NULL ;
2013-03-01 11:18:08 +01:00
GVariant * parameters ;
2015-06-23 10:29:50 +02:00
GVariantBuilder builder ;
2013-03-01 11:18:08 +01:00
int i ;
2010-07-12 18:07:47 +01:00
2015-06-20 15:20:15 +02:00
g_return_val_if_fail ( start_panels [ 0 ] ! = NULL , 1 ) ;
2010-12-02 19:17:38 +00:00
start_id = start_panels [ 0 ] ;
2010-10-22 14:08:11 +01:00
2011-08-22 14:22:37 +02:00
if ( start_panels [ 1 ] )
2013-02-16 21:56:16 -05:00
g_debug ( " Extra argument: %s " , start_panels [ 1 ] ) ;
2011-08-22 14:22:37 +02:00
else
2013-02-16 21:56:16 -05:00
g_debug ( " No extra argument " ) ;
2011-08-22 14:22:37 +02:00
2015-06-23 10:29:50 +02:00
g_variant_builder_init ( & builder , G_VARIANT_TYPE ( " av " ) ) ;
2013-03-01 11:18:08 +01:00
for ( i = 1 ; start_panels [ i ] ! = NULL ; i + + )
2015-06-23 10:29:50 +02:00
g_variant_builder_add ( & builder , " v " , g_variant_new_string ( start_panels [ i ] ) ) ;
parameters = g_variant_builder_end ( & builder ) ;
2018-01-21 10:31:07 -02:00
if ( ! cc_shell_set_active_panel_from_id ( CC_SHELL ( self - > window ) , start_id , parameters , & err ) )
2010-05-19 11:11:26 +01:00
{
2010-10-22 14:08:11 +01:00
g_warning ( " Could not load setting panel \" %s \" : %s " , start_id ,
( err ) ? err - > message : " Unknown error " ) ;
2010-10-29 15:55:40 +01:00
retval = 1 ;
2018-03-06 22:05:03 -03:00
2010-05-19 11:11:26 +01:00
if ( err )
2018-03-06 22:05:03 -03:00
g_clear_error ( & err ) ;
2010-05-19 11:11:26 +01:00
}
}
2010-11-19 15:08:23 -05:00
2010-10-29 15:55:40 +01:00
return retval ;
2010-10-22 14:08:11 +01:00
}
2012-05-06 02:57:51 +02:00
static void
2013-02-16 21:56:16 -05:00
cc_application_quit ( GSimpleAction * simple ,
2018-01-21 10:31:07 -02:00
GVariant * parameter ,
gpointer user_data )
2012-05-06 02:57:51 +02:00
{
2013-02-16 21:56:16 -05:00
CcApplication * self = CC_APPLICATION ( user_data ) ;
2012-05-06 02:57:51 +02:00
2021-10-19 20:57:26 -03:00
gtk_window_destroy ( GTK_WINDOW ( self - > window ) ) ;
2012-05-06 02:57:51 +02:00
}
2013-02-16 21:56:16 -05:00
2012-05-06 02:57:51 +02:00
static void
2013-02-16 21:56:16 -05:00
cc_application_activate ( GApplication * application )
2012-05-06 02:57:51 +02:00
{
2013-02-16 21:56:16 -05:00
CcApplication * self = CC_APPLICATION ( application ) ;
2018-01-21 10:31:07 -02:00
gtk_window_present ( GTK_WINDOW ( self - > window ) ) ;
2012-05-06 02:57:51 +02:00
}
2010-10-22 14:08:11 +01:00
static void
2013-02-16 21:56:16 -05:00
cc_application_startup ( GApplication * application )
2010-10-22 14:08:11 +01:00
{
2013-02-16 21:56:16 -05:00
CcApplication * self = CC_APPLICATION ( application ) ;
2014-11-29 19:22:52 +01:00
const gchar * help_accels [ ] = { " F1 " , NULL } ;
2021-10-19 20:58:49 -03:00
g_autoptr ( GtkCssProvider ) provider = NULL ;
2013-02-16 21:56:16 -05:00
2018-03-06 22:35:06 -03:00
g_action_map_add_action_entries ( G_ACTION_MAP ( self ) ,
cc_app_actions ,
G_N_ELEMENTS ( cc_app_actions ) ,
self ) ;
2013-02-16 21:56:16 -05:00
G_APPLICATION_CLASS ( cc_application_parent_class ) - > startup ( application ) ;
2014-11-29 19:22:52 +01:00
gtk_application_set_accels_for_action ( GTK_APPLICATION ( application ) ,
" app.help " , help_accels ) ;
2012-11-02 20:50:42 -04:00
2018-04-08 17:13:42 -03:00
self - > model = cc_shell_model_new ( ) ;
self - > window = cc_window_new ( GTK_APPLICATION ( application ) , self - > model ) ;
2021-10-19 20:58:49 -03:00
provider = gtk_css_provider_new ( ) ;
2022-01-20 00:02:02 -03:00
gtk_css_provider_load_from_resource ( provider , " /org/gnome/Settings/gtk/style.css " ) ;
2021-10-19 20:58:49 -03:00
gtk_style_context_add_provider_for_display ( gdk_display_get_default ( ) ,
GTK_STYLE_PROVIDER ( provider ) ,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION ) ;
2009-08-08 15:07:16 +02:00
}
2018-03-27 17:48:08 -03:00
static void
cc_application_finalize ( GObject * object )
{
/* Destroy the object storage cache when finalizing */
cc_object_storage_destroy ( ) ;
G_OBJECT_CLASS ( cc_application_parent_class ) - > finalize ( object ) ;
}
2013-02-16 21:56:16 -05:00
static GObject *
2018-01-21 10:31:07 -02:00
cc_application_constructor ( GType type ,
guint n_construct_params ,
2013-02-16 21:56:16 -05:00
GObjectConstructParam * construct_params )
2006-11-13 08:33:07 +00:00
{
2013-02-16 21:56:16 -05:00
static GObject * self = NULL ;
2010-05-19 11:11:26 +01:00
2013-02-16 21:56:16 -05:00
if ( self = = NULL )
{
self = G_OBJECT_CLASS ( cc_application_parent_class ) - > constructor ( type ,
n_construct_params ,
construct_params ) ;
g_object_add_weak_pointer ( self , ( gpointer ) & self ) ;
return self ;
}
2010-05-24 22:48:34 +01:00
2013-02-16 21:56:16 -05:00
return g_object_ref ( self ) ;
}
2012-02-17 12:46:45 +01:00
2013-02-16 21:56:16 -05:00
static void
2018-01-21 10:31:07 -02:00
cc_application_class_init ( CcApplicationClass * klass )
2013-02-16 21:56:16 -05:00
{
2018-01-21 10:31:07 -02:00
GObjectClass * object_class = G_OBJECT_CLASS ( klass ) ;
GApplicationClass * application_class = G_APPLICATION_CLASS ( klass ) ;
2013-02-16 21:56:16 -05:00
2018-03-27 17:48:08 -03:00
object_class - > finalize = cc_application_finalize ;
2013-02-16 21:56:16 -05:00
object_class - > constructor = cc_application_constructor ;
application_class - > activate = cc_application_activate ;
application_class - > startup = cc_application_startup ;
application_class - > command_line = cc_application_command_line ;
2015-06-23 16:54:42 +02:00
application_class - > handle_local_options = cc_application_handle_local_options ;
2013-02-16 21:56:16 -05:00
}
2010-05-19 11:11:26 +01:00
2018-01-21 10:31:07 -02:00
static void
cc_application_init ( CcApplication * self )
{
2018-03-27 17:48:08 -03:00
cc_object_storage_initialize ( ) ;
2018-01-21 10:31:07 -02:00
g_application_add_main_option_entries ( G_APPLICATION ( self ) , all_options ) ;
}
2010-05-19 11:11:26 +01:00
2013-02-16 21:56:16 -05:00
GtkApplication *
cc_application_new ( void )
{
return g_object_new ( CC_TYPE_APPLICATION ,
2022-01-20 00:02:02 -03:00
" application-id " , " org.gnome.Settings " ,
2013-02-16 21:56:16 -05:00
" flags " , G_APPLICATION_HANDLES_COMMAND_LINE ,
NULL ) ;
2010-05-19 11:11:26 +01:00
}
2018-04-08 17:13:42 -03:00
CcShellModel *
cc_application_get_model ( CcApplication * self )
{
g_return_val_if_fail ( CC_IS_APPLICATION ( self ) , NULL ) ;
return self - > model ;
}