~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/panel-context-menu.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher, Sebastien Bacher, Jeremy Bicha
  • Date: 2011-05-30 11:04:49 UTC
  • mfrom: (1.13.10 upstream) (2.2.5 experimental)
  • Revision ID: james.westby@ubuntu.com-20110530110449-hinl17kxkcefjw6x
Tags: 1:3.0.2-0ubuntu1
[ Sebastien Bacher ]
* New upstream version
* debian/control.in:
  - the new libgweather version is in oneiric, use it
  - drop the python and python-gconf depends, 
    they were added for gnome-panel-add which is still using gconf and buggy
* debian/gnome-panel-data.install:
  - don't install the apport hook, it's only getting gconf datas which 
    doesn't work since gnome-panel uses gsettings
* debian/patches/90_build_fixes.patch:
  - restore build fix from git not applied in the new serie
* debian/patches/01_panel_submenus.patch:
  - don't take that Debian diff, the .menus use the upstream naming in Ubuntu
* debian/patches/06_no_resize_grip.patch:
  - dropped, the issue is fixed in the new version
* debian/patches/50_fix-potfiles.patch:
  - dropped, the issue is fixed in the new version
* debian/watch:
  - track unstable series as well

Drop those delta, since gnome-panel is not the default Ubuntu session now we
can go back to an experience closer to the upstream one: 
* debian/control.in:
  - drop the indicators recommends, unity-2d is the ubuntu fallback session
    so we can get back to use an upstream config for gnome-panel and reduce
    the delta we carry
* debian/patches/04_default_panel_config.patch:
  - don't modify the upstream layout
* debian/patches/05_no_session_delay.patch:
  - no need to tweak the upstream session to optimize it
* debian/patches/16_compiz_workspace_switcher.patch:
  - go back to the upstream switcher behaviour    
* debian/patches/25_dynamic_fusa_detection.patch:
  - not needed since we use the upstream layout, could be ported if someone
    is wanting to do the work though
* debian/patches/30_disable-initial-animation.patch, debian/rules:
  - drop the --disable-initial-animation, that was some login optimization
    but since it's not the default desktop you should go back to the 
    upstream behaviour

[ Jeremy Bicha ]   
* New upstream version
* Merge from Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Recommends gnome-settings-daemon which has the timezone polkit service
* debian/rules:
  - Update translations template.
* debian/gnome-panel-data.install:
  - Install apport hook
  - Install the "About Ubuntu" menu item.
* debian/patches/01_layout.patch:
  - Disabled, Help & About Ubuntu don't fit as well in Gnome Panel 3
* debian/patches/01_panel_submenus.patch.
  - Dropped
* debian/patches/03_dnd_places_link.patch:
  - Disabled, when using Drag'n'Drop from Places menu, install a link launcher
    (.desktop file) instead of copying the entire directory.
* debian/patches/17_about-ubuntu-translation.patch:
  - List ubuntu-about.desktop for translation.
* debian/patches/40_unset_menuproxy.patch:
  - Make sure gnome-panel and the applets don't pick up menu proxies.
* debian/patches/50_fix-potfiles.patch
  - Fix i18n
* debian/patches/85_disable_shutdown_on_ltsp.patch:
  - Suppress the shutdown option in the panel if LTSP_CLIENT is set.
* debian/patches/71_change_bookmark_submenu_limit_value.patch
  - Dropped, picked up by Debian
* debian/patches/18_lockdown_lock_editor.patch:
* debian/patches/90_git_wnck_show_realize.patch:
* debian/patches/90_fix_linking_DSO_link.patch:
* debian/patches/91_gir_annotations.patch
* debian/patches/92_git_calendar_day.patch
* debian/patches/92_git_fix_applets_in_multiscreen.patch:
  - Dropped, applied upstream
* debian/watch:
  - watch unstable versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "panel-util.h"
42
42
#include "panel.h"
43
43
#include "menu.h"
44
 
#include "applet.h"
45
 
#include "panel-config-global.h"
46
 
#include "panel-profile.h"
47
44
#include "panel-properties-dialog.h"
 
45
#include "panel-layout.h"
48
46
#include "panel-lockdown.h"
49
47
#include "panel-addto.h"
50
48
#include "panel-icon-names.h"
51
49
 
52
50
static void
53
 
panel_context_menu_show_help (GtkWidget *w,
54
 
                              gpointer data)
55
 
{
56
 
        panel_show_help (gtk_widget_get_screen (w),
57
 
                         "user-guide", "gospanel-1", NULL);
 
51
panel_context_menu_create_new_panel (GtkWidget *menuitem)
 
52
{
 
53
        panel_layout_toplevel_create (gtk_widget_get_screen (menuitem));
 
54
}
 
55
 
 
56
static void
 
57
panel_context_menu_delete_panel (PanelToplevel *toplevel)
 
58
{
 
59
        if (panel_toplevel_is_last (toplevel)) {
 
60
                panel_error_dialog (GTK_WINDOW (toplevel),
 
61
                                    gtk_window_get_screen (GTK_WINDOW (toplevel)),
 
62
                                    "cannot_delete_last_panel", TRUE,
 
63
                                    _("Cannot delete this panel"),
 
64
                                    _("You must always have at least one panel."));
 
65
                return;
 
66
        }
 
67
 
 
68
        panel_delete (toplevel);
58
69
}
59
70
 
60
71
static gboolean
63
74
                                     gpointer data)
64
75
{
65
76
        static int times = 0;
 
77
        if (!w) {
 
78
                times = 0;
 
79
                return FALSE;
 
80
        }
66
81
        if (ev->type != GDK_KEY_PRESS)
67
82
                return FALSE;
68
 
        if (ev->key.keyval == GDK_f ||
69
 
            ev->key.keyval == GDK_F) {
 
83
        if (ev->key.keyval == GDK_KEY_f ||
 
84
            ev->key.keyval == GDK_KEY_F) {
70
85
                times++;
71
86
                if (times == 3) {
72
87
                        times = 0;
77
92
}
78
93
 
79
94
static void
80
 
panel_context_menu_show_about_dialog (GtkWidget *menuitem)
81
 
{
82
 
        static GtkWidget *about = NULL;
83
 
        char             *authors [] = {
84
 
                "Alex Larsson <alexl@redhat.com>",
85
 
                "Anders Carlsson <andersca@gnu.org>",
86
 
                "Arvind Samptur <arvind.samptur@wipro.com>",
87
 
                "Darin Adler <darin@bentspoon.com>",
88
 
                "Elliot Lee <sopwith@redhat.com>",
89
 
                "Federico Mena <quartic@gimp.org>",
90
 
                "George Lebl <jirka@5z.com>",
91
 
                "Glynn Foster <glynn.foster@sun.com>",
92
 
                "Ian Main <imain@gtk.org>",
93
 
                "Ian McKellar <yakk@yakk.net>",
94
 
                "Jacob Berkman <jberkman@andrew.cmu.edu>",
95
 
                "Mark McLoughlin <mark@skynet.ie>",
96
 
                "Martin Baulig <baulig@suse.de>",
97
 
                "Miguel de Icaza <miguel@kernel.org>",
98
 
                "Owen Taylor <otaylor@redhat.com>",
99
 
                "Padraig O'Briain <padraig.obriain@sun.com>",
100
 
                "Seth Nickell <snickell@stanford.edu>",
101
 
                "Stephen Browne <stephen.browne@sun.com>",
102
 
                "Tom Tromey <tromey@cygnus.com>",
103
 
                "Vincent Untz <vuntz@gnome.org>",
104
 
                N_("And many, many others..."),
105
 
                NULL
106
 
        };
107
 
        char *documenters[] = {
108
 
                "Alexander Kirillov <kirillov@math.sunysb.edu>",
109
 
                "Dan Mueth <d-mueth@uchicago.edu>",
110
 
                "Dave Mason <dcm@redhat.com>",
111
 
                NULL
112
 
          };
113
 
        int   i;
114
 
 
115
 
        if (about) {
116
 
                gtk_window_set_screen (GTK_WINDOW (about),
117
 
                                       menuitem_to_screen (menuitem));
118
 
                gtk_window_present (GTK_WINDOW (about));
119
 
                return;
120
 
        }
121
 
 
122
 
        for (i = 0; authors [i]; i++)
123
 
                authors [i] = _(authors [i]);
124
 
 
125
 
        /* Note: we don't use gtk_show_about_dialog() since some applets can
126
 
         * be loaded in this process and we don't want to share the about
127
 
         * dialog */
128
 
        about = gtk_about_dialog_new ();
129
 
        g_object_set (about,
130
 
                      "program-name",  _("The GNOME Panel"),
131
 
                      "version", VERSION,
132
 
                      "copyright", "Copyright \xc2\xa9 1997-2003 Free Software Foundation, Inc.",
133
 
                      "comments", _("This program is responsible for launching other "
134
 
                                    "applications and provides useful utilities."),
135
 
                      "authors", authors,
136
 
                      "documenters", documenters,
137
 
                      "title", _("About the GNOME Panel"),
138
 
                      "translator-credits", _("translator-credits"),
139
 
                      "logo-icon-name", PANEL_ICON_PANEL,
140
 
                      NULL);
141
 
 
142
 
        gtk_window_set_screen (GTK_WINDOW (about),
143
 
                               menuitem_to_screen (menuitem));
144
 
        g_signal_connect (about, "destroy",
145
 
                          G_CALLBACK (gtk_widget_destroyed),
146
 
                          &about);
147
 
        g_signal_connect (about, "event",
148
 
                          G_CALLBACK (panel_context_menu_check_for_screen),
149
 
                          NULL);
150
 
 
151
 
        g_signal_connect (about, "response",
152
 
                          G_CALLBACK (gtk_widget_destroy),
153
 
                          NULL);
154
 
 
155
 
        gtk_widget_show (about);
156
 
}
157
 
 
158
 
static void
159
 
panel_context_menu_create_new_panel (GtkWidget *menuitem)
160
 
{
161
 
        panel_profile_create_toplevel (gtk_widget_get_screen (menuitem));
162
 
}
163
 
 
164
 
static void
165
 
panel_context_menu_delete_panel (PanelToplevel *toplevel)
166
 
{
167
 
        if (panel_toplevel_is_last_unattached (toplevel)) {
168
 
                panel_error_dialog (GTK_WINDOW (toplevel),
169
 
                                    gtk_window_get_screen (GTK_WINDOW (toplevel)),
170
 
                                    "cannot_delete_last_panel", TRUE,
171
 
                                    _("Cannot delete this panel"),
172
 
                                    _("You must always have at least one panel."));
173
 
                return;
174
 
        }
175
 
 
176
 
        panel_delete (toplevel);
177
 
}
178
 
 
179
 
static void
180
95
panel_context_menu_setup_delete_panel_item (GtkWidget *menu,
181
96
                                            GtkWidget *menuitem)
182
97
{
183
98
        PanelWidget *panel_widget;
184
99
        gboolean     sensitive;
185
100
 
 
101
        panel_context_menu_check_for_screen (NULL, NULL, NULL);
 
102
 
186
103
        panel_widget = menu_get_panel (menu);
187
104
 
188
105
        g_assert (PANEL_IS_TOPLEVEL (panel_widget->toplevel));
189
106
 
190
107
        sensitive =
191
 
                !panel_toplevel_is_last_unattached (panel_widget->toplevel) &&
192
 
                !panel_lockdown_get_locked_down () &&
193
 
                panel_profile_id_lists_are_writable ();
 
108
                !panel_toplevel_is_last (panel_widget->toplevel) &&
 
109
                !panel_lockdown_get_panels_locked_down_s () &&
 
110
                panel_layout_is_writable ();
194
111
 
195
112
        gtk_widget_set_sensitive (menuitem, sensitive);
196
113
}
210
127
        g_signal_connect (G_OBJECT (menuitem), "activate",
211
128
                          G_CALLBACK (panel_addto_present), panel_widget);
212
129
 
213
 
        if (!panel_profile_id_lists_are_writable ())
 
130
        if (!panel_layout_is_writable ())
214
131
                gtk_widget_set_sensitive (menuitem, FALSE);
215
132
 
216
133
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("_Properties"));
247
164
                          G_CALLBACK (panel_context_menu_create_new_panel), 
248
165
                          NULL);
249
166
        gtk_widget_set_sensitive (menuitem, 
250
 
                                  panel_profile_id_lists_are_writable ());
251
 
 
252
 
        add_menu_separator (menu);
 
167
                                  panel_layout_is_writable ());
253
168
}
254
169
 
255
170
GtkWidget *
256
171
panel_context_menu_create (PanelWidget *panel)
257
172
{
258
173
        GtkWidget *retval;
259
 
        GtkWidget *menuitem;
260
 
        GtkWidget *image;
261
 
 
262
 
        if (panel->master_widget) {
263
 
                gpointer    *pointer;
264
 
                AppletInfo  *info;
265
 
 
266
 
                pointer = g_object_get_data (G_OBJECT (panel->master_widget),
267
 
                                             "applet_info");
268
 
 
269
 
                g_assert (pointer != NULL);
270
 
                info = (AppletInfo *) pointer;
271
 
 
272
 
                if (info->menu == NULL) {
273
 
                        info->menu = panel_applet_create_menu (info);
274
 
                }
275
 
 
276
 
                return info->menu;
277
 
        }
 
174
 
 
175
        if (panel_lockdown_get_panels_locked_down_s ())
 
176
                return NULL;
278
177
 
279
178
        retval = create_empty_menu ();
 
179
 
280
180
        gtk_widget_set_name (retval, "gnome-panel-context-menu");
281
181
 
282
 
        if (!panel_lockdown_get_locked_down ())
283
 
                panel_context_menu_build_edition (panel, retval);
284
 
 
285
 
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("_Help"));
286
 
        image = gtk_image_new_from_stock (GTK_STOCK_HELP, GTK_ICON_SIZE_MENU);
287
 
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
288
 
        gtk_widget_show (menuitem);
289
 
        gtk_menu_shell_append (GTK_MENU_SHELL (retval), menuitem);
290
 
        g_signal_connect (menuitem, "activate",
291
 
                          G_CALLBACK (panel_context_menu_show_help), NULL);
292
 
 
293
 
        menuitem = gtk_image_menu_item_new_with_mnemonic (_("A_bout Panels"));
294
 
        image = gtk_image_new_from_stock (GTK_STOCK_ABOUT,
295
 
                                          GTK_ICON_SIZE_MENU);
296
 
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
297
 
        gtk_widget_show (menuitem);
298
 
        gtk_menu_shell_append (GTK_MENU_SHELL (retval), menuitem);
299
 
        g_signal_connect (menuitem, "activate",
300
 
                          G_CALLBACK (panel_context_menu_show_about_dialog),
301
 
                          NULL);
302
 
        
 
182
        panel_context_menu_build_edition (panel, retval);
 
183
 
303
184
        //FIXME: can we get rid of this? (needed by menu_get_panel())
304
185
        g_object_set_data (G_OBJECT (retval), "menu_panel", panel);
305
186
 
 
187
        g_signal_connect (retval, "event",
 
188
                          G_CALLBACK (panel_context_menu_check_for_screen),
 
189
                          NULL);
 
190
 
306
191
        return retval;
307
192
}