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

« back to all changes in this revision

Viewing changes to gnome-panel/panel-separator.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:
24
24
 
25
25
#include <config.h>
26
26
 
 
27
#include "panel-background.h"
 
28
#include "panel-layout.h"
 
29
 
27
30
#include "panel-separator.h"
28
 
#include "panel-background.h"
29
 
#include "panel-profile.h"
30
31
 
31
32
#define SEPARATOR_SIZE 10
32
33
 
41
42
 
42
43
G_DEFINE_TYPE (PanelSeparator, panel_separator, GTK_TYPE_EVENT_BOX)
43
44
 
44
 
static void
45
 
panel_separator_paint (GtkWidget    *widget,
46
 
                       GdkRectangle *area)
 
45
static gboolean
 
46
panel_separator_draw (GtkWidget *widget,
 
47
                      cairo_t   *cr)
47
48
{
48
 
        PanelSeparator *separator;
49
 
        GdkWindow      *window;
50
 
        GtkStyle       *style;
51
 
        GtkAllocation   allocation;
 
49
        PanelSeparator  *separator = PANEL_SEPARATOR (widget);
 
50
        GdkWindow       *window;
 
51
        GtkStyleContext *context;
 
52
        GtkStateFlags    state;
 
53
        GtkBorder        padding;
 
54
        int              width, height;
52
55
 
53
 
        separator = PANEL_SEPARATOR (widget);
 
56
        if (GTK_WIDGET_CLASS (panel_separator_parent_class)->draw)
 
57
                GTK_WIDGET_CLASS (panel_separator_parent_class)->draw (widget, cr);
54
58
 
55
59
        window = gtk_widget_get_window (widget);
56
 
        style = gtk_widget_get_style (widget);
57
 
        gtk_widget_get_allocation (widget, &allocation);
58
 
 
 
60
        state = gtk_widget_get_state_flags (widget);
 
61
        width = gtk_widget_get_allocated_width (widget);
 
62
        height = gtk_widget_get_allocated_height (widget);
 
63
 
 
64
        context = gtk_widget_get_style_context (widget);
 
65
        gtk_style_context_get_padding (context, state, &padding);
 
66
 
 
67
        gtk_style_context_save (context);
 
68
        gtk_style_context_set_state (context, state);
 
69
 
 
70
        cairo_save (cr);
59
71
        if (separator->priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
60
 
                gtk_paint_vline (style, window,
61
 
                                 gtk_widget_get_state (widget),
62
 
                                 area, widget, "separator",
63
 
                                 style->xthickness,
64
 
                                 allocation.height - style->xthickness,
65
 
                                 (allocation.width - style->xthickness) / 2);
 
72
                int x;
 
73
 
 
74
                x= (width - padding.left - padding.right) / 2 + padding.left;
 
75
                x = MIN (x, width - padding.right);
 
76
 
 
77
                gtk_render_line (context, cr,
 
78
                                 x, padding.top,
 
79
                                 x, height - padding.bottom);
66
80
        } else {
67
 
                gtk_paint_hline (style, window,
68
 
                                 gtk_widget_get_state (widget),
69
 
                                 area, widget, "separator",
70
 
                                 style->ythickness,
71
 
                                 allocation.width - style->ythickness,
72
 
                                 (allocation.height  - style->ythickness) / 2);
73
 
        }
74
 
}
75
 
 
76
 
static gboolean
77
 
panel_separator_expose_event (GtkWidget      *widget,
78
 
                              GdkEventExpose *event)
79
 
{
80
 
        if (gtk_widget_is_drawable (widget)) {
81
 
                GTK_WIDGET_CLASS (panel_separator_parent_class)->expose_event (widget, event);
82
 
 
83
 
                panel_separator_paint (widget, &event->area);
84
 
        }
 
81
                int y;
 
82
 
 
83
                y = (height - padding.top - padding.bottom) / 2 + padding.top;
 
84
                y = MIN (y, height - padding.bottom);
 
85
 
 
86
                gtk_render_line (context, cr,
 
87
                                 padding.left, y,
 
88
                                 width - padding.right, y);
 
89
        }
 
90
        cairo_restore (cr);
 
91
 
 
92
        gtk_style_context_restore (context);
85
93
 
86
94
        return FALSE;
87
95
}
88
96
 
89
97
static void
90
 
panel_separator_size_request (GtkWidget      *widget,
91
 
                              GtkRequisition *requisition)
92
 
{
93
 
        PanelSeparator *separator;
94
 
        int             size;
95
 
 
96
 
        separator = PANEL_SEPARATOR (widget);
97
 
 
98
 
        size = panel_toplevel_get_size (separator->priv->panel->toplevel);
99
 
 
100
 
        if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL) {
101
 
                requisition->width = size;
102
 
                requisition->height = SEPARATOR_SIZE;
103
 
        } else {
104
 
                requisition->width = SEPARATOR_SIZE;
105
 
                requisition->height = size;
106
 
        }
 
98
panel_separator_get_preferred_width (GtkWidget *widget,
 
99
                                     gint      *minimal_width,
 
100
                                     gint      *natural_width)
 
101
{
 
102
        PanelSeparator *separator;
 
103
        int             size;
 
104
 
 
105
        separator = PANEL_SEPARATOR (widget);
 
106
 
 
107
        size = panel_toplevel_get_size (separator->priv->panel->toplevel);
 
108
 
 
109
        if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL)
 
110
                *minimal_width = *natural_width = size;
 
111
        else
 
112
                *minimal_width = *natural_width = SEPARATOR_SIZE;
 
113
}
 
114
 
 
115
static void
 
116
panel_separator_get_preferred_height (GtkWidget *widget,
 
117
                                      gint      *minimal_height,
 
118
                                      gint      *natural_height)
 
119
{
 
120
        PanelSeparator *separator;
 
121
        int             size;
 
122
 
 
123
        separator = PANEL_SEPARATOR (widget);
 
124
 
 
125
        size = panel_toplevel_get_size (separator->priv->panel->toplevel);
 
126
 
 
127
        if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL)
 
128
                *minimal_height = *natural_height = SEPARATOR_SIZE;
 
129
        else
 
130
                *minimal_height = *natural_height = size;
107
131
}
108
132
 
109
133
static void
158
182
{
159
183
        GtkWidgetClass *widget_class  = GTK_WIDGET_CLASS (klass);
160
184
 
161
 
        widget_class->expose_event  = panel_separator_expose_event;
162
 
        widget_class->size_request  = panel_separator_size_request;
163
 
        widget_class->size_allocate = panel_separator_size_allocate;
164
 
        widget_class->parent_set    = panel_separator_parent_set;
 
185
        widget_class->draw                 = panel_separator_draw;
 
186
        widget_class->get_preferred_width  = panel_separator_get_preferred_width;
 
187
        widget_class->get_preferred_height = panel_separator_get_preferred_height;
 
188
        widget_class->size_allocate        = panel_separator_size_allocate;
 
189
        widget_class->parent_set           = panel_separator_parent_set;
165
190
 
166
191
        g_type_class_add_private (klass, sizeof (PanelSeparatorPrivate));
167
192
}
204
229
}
205
230
 
206
231
void
207
 
panel_separator_load_from_gconf (PanelWidget *panel,
208
 
                                 gboolean     locked,
209
 
                                 int          position,
210
 
                                 const char  *id)
 
232
panel_separator_load (PanelWidget *panel,
 
233
                      const char  *id,
 
234
                      GSettings   *settings)
211
235
{
212
236
        PanelSeparator *separator;
213
237
 
214
238
        separator = g_object_new (PANEL_TYPE_SEPARATOR, NULL);
215
239
 
216
240
        separator->priv->info = panel_applet_register (GTK_WIDGET (separator),
217
 
                                                       NULL, NULL,
218
 
                                                       panel, locked, position,
219
 
                                                       TRUE,
 
241
                                                       panel,
220
242
                                                       PANEL_OBJECT_SEPARATOR,
221
 
                                                       id);
 
243
                                                       id, settings,
 
244
                                                       NULL, NULL
 
245
                                                       );
222
246
 
223
247
        if (!separator->priv->info) {
224
248
                gtk_widget_destroy (GTK_WIDGET (separator));
232
256
}
233
257
 
234
258
void
235
 
panel_separator_create (PanelToplevel *toplevel,
236
 
                        int            position)
 
259
panel_separator_create (PanelToplevel       *toplevel,
 
260
                        PanelObjectPackType  pack_type,
 
261
                        int                  pack_index)
237
262
{
238
 
        char *id;
239
 
 
240
 
        id = panel_profile_prepare_object (PANEL_OBJECT_SEPARATOR,
241
 
                                           toplevel, position, FALSE);
242
 
        panel_profile_add_to_list (PANEL_GCONF_OBJECTS, id);
243
 
        g_free (id);
 
263
        panel_layout_object_create (PANEL_OBJECT_SEPARATOR, NULL,
 
264
                                    panel_toplevel_get_id (toplevel),
 
265
                                    pack_type, pack_index);
244
266
}
245
267
 
246
268
void