~ubuntu-branches/ubuntu/utopic/gnome-control-center/utopic-proposed

« back to all changes in this revision

Viewing changes to .pc/53_use_ubuntu_help.patch/shell/control-center.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Sebastien Bacher, Robert Ancell, Iain Lane, Edward Donovan, Rico Tzschichholz, Jeremy Bicha, David Henningsson
  • Date: 2012-11-21 19:32:45 UTC
  • mfrom: (1.1.63)
  • Revision ID: package-import@ubuntu.com-20121121193245-mj61nzz1z4fk3z25
Tags: 1:3.6.3-0ubuntu1
[ Sebastien Bacher ]
* New upstream version
* debian/control.in: recommends libcanberra-pulse (lp: #1004973)
* debian/patches/58_ubuntu_icon_views_redesign.patch:
  - drop most of the changes, keep the different grid size though
    to fit on screen with our extra icons
* debian/patches/91_dont_show_in_unity.patch:
  - dropped, show the upstream printer panel and the layout tab
* debian/patches/revert_git_keyboard_gsettings.patch,
  debian/patches/revert_git_stop_using_gconf.patch:
  - dropped the gconf->gsettings reverts

[ Robert Ancell ]
* New upstream release (LP: #1010317)
* debian/control:
  - Bump build-depends on libgnome-desktop-3-dev, libwacom-dev
  - Add build-depends on libclutter-1.0-dev, libclutter-gtk-1.0-dev,
    libpwquality-dev
  - Drop build-depends on libgnomekbd-dev
* debian/patches/60_ubuntu_nav_bar.patch:
  - Disabled for now, doesn't apply
* debian/patches/revert_ua_gsettings.patch:
  - We can use GSettings for universal access now
* debian/patches/00git_online_accounts_gtkgrid.patch:
* debian/patches/00git_online_accounts_layout.part:
* debian/patches/git_wacom_translations.patch:
  - Applied upstream

[ Iain Lane ]
* Add Build-Depends on libxkbfile-dev
* New upstream release.
* Refresh all patches to apply cleanly.

[ Edward Donovan ]
* debian/source_gnome-control-center.py: Fix for Python 3. (LP: #1013171)

[ Rico Tzschichholz ]
* debian/control.in:
  - Build-depend on gtk-doc-tools instead of docbook directly
  - Bump minimum glib-2.0, gnome-desktop3, gnome-settings-daemon
     and gsettings-desktop-schemas

[ Jeremy Bicha ]
* Dropped more patches applied in new version:
  - git_unmute_sound_event.patch
  - git_fix_big_editable_labels.patch
  - 96_sound_nua_panel.patch
* debian/patches/04_new_appearance_settings.patch:
  - Dropped, this is now packaged separately as gnome-control-center-unity
* debian/patches/10_keyboard_layout_on_unity.patch:
  - Don't change the keyboard panel name when not running Unity
* debian/patches/52_ubuntu_language_list_mods.patch:
  - Don't disable adding current language to the list. While this
    fix shows the current language twice, at least it avoids the
    "Ubuntu suddenly in Chinese" bug (LP: #1035219)
* debian/patches/53_use_ubuntu_help.patch:
  - Only show Ubuntu help when running Unity
* debian/patches/58_hide_gdm_notifications.patch:
  - Hide "Show notifications when locked" settings when running Unity
    since it's a GNOME Shell-specific feature
* debian/patches/63_normal_scrollbar_in_a11y.patch:
  - Drop, overlay-scrollbars should handle this instead
* debian/patches/91_dont_show_in_unity.patch:
  - Hide Printers & Region panels in Unity until we're ready to switch
    to them.
* debian/patches/fix-crash-on-user-panel.patch:
  - Dropped, GNOME says it's obsolete
* debian/rules:
  - Build with -z,defs again
  - Explicitly disable ibus support since ibus 1.4 isn't supported in
    this version
* debian/control.in:
  - Drop ubuntu-docs and gnome-user-guide from recommends to suggests
  - Don't recommend indicators; let's leave that to Unity

[ David Henningsson ]
* sound_nua_panel.patch: Rebase to gnome 3.6 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2009, 2010 Intel, Inc.
 
3
 * Copyright (c) 2010 Red Hat, Inc.
 
4
 *
 
5
 * The Control Center is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by the
 
7
 * Free Software Foundation; either version 2 of the License, or (at your
 
8
 * option) any later version.
 
9
 *
 
10
 * The Control Center is distributed in the hope that it will be useful, but
 
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
12
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
13
 * for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License along
 
16
 * with the Control Center; if not, write to the Free Software Foundation,
 
17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 *
 
19
 * Author: Thomas Wood <thos@gnome.org>
 
20
 */
 
21
 
 
22
#include "config.h"
 
23
 
 
24
#include <glib/gi18n.h>
 
25
#include <stdlib.h>
 
26
 
 
27
#include "gnome-control-center.h"
 
28
 
 
29
#include <gtk/gtk.h>
 
30
#include <string.h>
 
31
#include <libnotify/notify.h>
 
32
 
 
33
#ifdef GDK_WINDOWING_X11
 
34
#include <X11/Xlib.h>
 
35
#endif
 
36
 
 
37
#include "cc-shell-log.h"
 
38
 
 
39
G_GNUC_NORETURN static gboolean
 
40
option_version_cb (const gchar *option_name,
 
41
                   const gchar *value,
 
42
                   gpointer     data,
 
43
                   GError     **error)
 
44
{
 
45
  g_print ("%s %s\n", PACKAGE, VERSION);
 
46
  exit (0);
 
47
}
 
48
 
 
49
static char **start_panels = NULL;
 
50
static gboolean show_overview = FALSE;
 
51
static gboolean verbose = FALSE;
 
52
static gboolean show_help = FALSE;
 
53
static gboolean show_help_gtk = FALSE;
 
54
static gboolean show_help_all = FALSE;
 
55
 
 
56
const GOptionEntry all_options[] = {
 
57
  { "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL },
 
58
  { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, N_("Enable verbose mode"), NULL },
 
59
  { "overview", 'o', 0, G_OPTION_ARG_NONE, &show_overview, N_("Show the overview"), NULL },
 
60
  { "help", 'h', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help, N_("Show help options"), NULL },
 
61
  { "help-all", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_all, N_("Show help options"), NULL },
 
62
  { "help-gtk", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &show_help_gtk, N_("Show help options"), NULL },
 
63
  { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &start_panels, N_("Panel to display"), NULL },
 
64
  { NULL, 0, 0, 0, NULL, NULL, NULL } /* end the list */
 
65
};
 
66
 
 
67
static int
 
68
application_command_line_cb (GApplication  *application,
 
69
                             GApplicationCommandLine  *command_line,
 
70
                             GnomeControlCenter      *shell)
 
71
{
 
72
  int argc;
 
73
  char **argv;
 
74
  int retval = 0;
 
75
  GOptionContext *context;
 
76
  GError *error = NULL;
 
77
 
 
78
  verbose = FALSE;
 
79
  show_overview = FALSE;
 
80
  show_help = FALSE;
 
81
  start_panels = NULL;
 
82
 
 
83
  argv = g_application_command_line_get_arguments (command_line, &argc);
 
84
 
 
85
  context = g_option_context_new (N_("- System Settings"));
 
86
  g_option_context_add_main_entries (context, all_options, GETTEXT_PACKAGE);
 
87
  g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
 
88
  g_option_context_add_group (context, gtk_get_option_group (TRUE));
 
89
  g_option_context_set_help_enabled (context, FALSE);
 
90
 
 
91
  if (g_option_context_parse (context, &argc, &argv, &error) == FALSE)
 
92
    {
 
93
      g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
 
94
               error->message, argv[0]);
 
95
      g_error_free (error);
 
96
      g_option_context_free (context);
 
97
      return 1;
 
98
    }
 
99
 
 
100
  if (show_help || show_help_all || show_help_gtk)
 
101
    {
 
102
      gchar *help;
 
103
      GOptionGroup *group;
 
104
 
 
105
      if (show_help || show_help_all)
 
106
        group = NULL;
 
107
      else
 
108
        group = gtk_get_option_group (FALSE);
 
109
 
 
110
      help = g_option_context_get_help (context, FALSE, group);
 
111
      g_print ("%s", help);
 
112
      g_free (help);
 
113
      g_option_context_free (context);
 
114
      return 0;
 
115
    }
 
116
 
 
117
  g_option_context_free (context);
 
118
 
 
119
  cc_shell_log_set_debug (verbose);
 
120
 
 
121
  gnome_control_center_show (shell, GTK_APPLICATION (application));
 
122
 
 
123
  if (show_overview)
 
124
    {
 
125
      gnome_control_center_set_overview_page (shell);
 
126
    }
 
127
  else if (start_panels != NULL && start_panels[0] != NULL)
 
128
    {
 
129
      const char *start_id;
 
130
      GError *err = NULL;
 
131
 
 
132
      start_id = start_panels[0];
 
133
 
 
134
      if (start_panels[1])
 
135
        g_debug ("Extra argument: %s", start_panels[1]);
 
136
      else
 
137
        g_debug ("No extra argument");
 
138
 
 
139
      if (!cc_shell_set_active_panel_from_id (CC_SHELL (shell), start_id, (const gchar**)start_panels+1, &err))
 
140
        {
 
141
          g_warning ("Could not load setting panel \"%s\": %s", start_id,
 
142
                     (err) ? err->message : "Unknown error");
 
143
          retval = 1;
 
144
          if (err)
 
145
            {
 
146
              g_error_free (err);
 
147
              err = NULL;
 
148
            }
 
149
        }
 
150
    }
 
151
 
 
152
  gnome_control_center_present (shell);
 
153
  gdk_notify_startup_complete ();
 
154
 
 
155
  g_strfreev (argv);
 
156
  if (start_panels != NULL)
 
157
    {
 
158
      g_strfreev (start_panels);
 
159
      start_panels = NULL;
 
160
    }
 
161
  show_overview = FALSE;
 
162
 
 
163
  return retval;
 
164
}
 
165
 
 
166
static void
 
167
help_activated (GSimpleAction *action,
 
168
                GVariant      *parameter,
 
169
                gpointer       user_data)
 
170
{
 
171
  GnomeControlCenter *shell = user_data;
 
172
  CcPanel *panel = cc_shell_get_active_panel (CC_SHELL (shell));
 
173
  GtkWidget *window = cc_shell_get_toplevel (CC_SHELL (shell));
 
174
  const char *uri = NULL;
 
175
 
 
176
  if (panel)
 
177
    uri = cc_panel_get_help_uri (panel);
 
178
 
 
179
  gtk_show_uri (gtk_widget_get_screen (window),
 
180
                uri ? uri : "help:gnome-help/prefs",
 
181
                GDK_CURRENT_TIME, NULL);
 
182
}
 
183
 
 
184
static void
 
185
quit_activated (GSimpleAction *action,
 
186
                GVariant      *parameter,
 
187
                gpointer       user_data)
 
188
{
 
189
  GnomeControlCenter *shell = user_data;
 
190
  g_object_unref (shell);
 
191
}
 
192
 
 
193
static void
 
194
application_startup_cb (GApplication       *application,
 
195
                        GnomeControlCenter *shell)
 
196
{
 
197
  GMenu *menu, *section;
 
198
  GAction *action;
 
199
 
 
200
  action = G_ACTION (g_simple_action_new ("help", NULL));
 
201
  g_action_map_add_action (G_ACTION_MAP (application), action);
 
202
  g_signal_connect (action, "activate", G_CALLBACK (help_activated), shell);
 
203
 
 
204
  action = G_ACTION (g_simple_action_new ("quit", NULL));
 
205
  g_action_map_add_action (G_ACTION_MAP (application), action);
 
206
  g_signal_connect (action, "activate", G_CALLBACK (quit_activated), shell);
 
207
 
 
208
  menu = g_menu_new ();
 
209
 
 
210
  section = g_menu_new ();
 
211
  g_menu_append (section, _("Help"), "app.help");
 
212
  g_menu_append (section, _("Quit"), "app.quit");
 
213
 
 
214
  g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
 
215
 
 
216
  gtk_application_set_app_menu (GTK_APPLICATION (application),
 
217
                                G_MENU_MODEL (menu));
 
218
 
 
219
  gtk_application_add_accelerator (GTK_APPLICATION (application),
 
220
                                   "F1", "app.help", NULL);
 
221
 
 
222
  /* nothing else to do here, we don't want to show a window before
 
223
   * we've looked at the commandline
 
224
   */
 
225
}
 
226
 
 
227
int
 
228
main (int argc, char **argv)
 
229
{
 
230
  GnomeControlCenter *shell;
 
231
  GtkApplication *application;
 
232
  int status;
 
233
 
 
234
  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
 
235
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
236
  textdomain (GETTEXT_PACKAGE);
 
237
 
 
238
#ifdef GDK_WINDOWING_X11
 
239
  XInitThreads ();
 
240
#endif
 
241
 
 
242
  gtk_init (&argc, &argv);
 
243
  cc_shell_log_init ();
 
244
 
 
245
  /* register a symbolic icon size for use in sidebar lists */
 
246
  gtk_icon_size_register ("cc-sidebar-list", 24, 24);
 
247
 
 
248
  notify_init ("gnome-control-center");
 
249
 
 
250
  shell = gnome_control_center_new ();
 
251
 
 
252
  /* enforce single instance of this application */
 
253
  application = gtk_application_new ("org.gnome.ControlCenter", G_APPLICATION_HANDLES_COMMAND_LINE);
 
254
  g_signal_connect (application, "startup",
 
255
                    G_CALLBACK (application_startup_cb), shell);
 
256
  g_signal_connect (application, "command-line",
 
257
                    G_CALLBACK (application_command_line_cb), shell);
 
258
 
 
259
  status = g_application_run (G_APPLICATION (application), argc, argv);
 
260
 
 
261
  g_object_unref (application);
 
262
 
 
263
  return status;
 
264
}