~elementary-pantheon/wingpanel/0.2.x

« back to all changes in this revision

Viewing changes to src/Indicator/IndicatorObjectEntry.vala

  • Committer: Tarmac
  • Author(s): Tigran Gabrielyan
  • Date: 2013-08-19 19:41:11 UTC
  • mfrom: (146.1.2 wingpanel)
  • Revision ID: tarmac-20130819194111-5k1e6boe2ybn9wvx
Fixed bug #1091517 resulting in much less buggy indicators.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
            set_submenu (entry.menu);
73
73
 
74
74
            setup_drawing ();
 
75
 
 
76
            entry.menu.get_children ().foreach (setup_margin);
 
77
            entry.menu.insert.connect (setup_margin);
75
78
        }
76
79
 
77
80
        public IndicatorIface get_indicator () {
82
85
            return entry.name_hint ?? "";
83
86
        }
84
87
 
 
88
        private void setup_margin (Gtk.Widget widget) {
 
89
            widget.margin_left = 10;
 
90
            widget.margin_right = 9;
 
91
        }
 
92
 
85
93
        private void setup_drawing () {
86
94
            setup_entry_menu_parent ();
87
95
 
105
113
            menu_parent.app_paintable = true;
106
114
            menu_parent.set_visual (Gdk.Screen.get_default ().get_rgba_visual ());
107
115
 
108
 
            menu_parent.size_allocate.connect (entry_menu_parent_size_allocate);
109
116
            menu_parent.draw.connect (entry_menu_parent_draw_callback);
110
117
        }
111
118
 
112
 
        private void entry_menu_parent_size_allocate (Gtk.Allocation alloc) {
113
 
            /* entry.menu.margin_left = 10;
114
 
               entry.menu.margin_right = 9;
115
 
               FIXME => This is what we want to get, but to solve spacing issues we do this: */
116
 
 
117
 
            entry.menu.get_children ().foreach ((c) => {
118
 
                // make sure it is always right
119
 
                c.margin_left = 10;
120
 
                c.margin_right = 9;
121
 
            });
122
 
        }
123
 
 
124
119
        private bool entry_menu_parent_draw_callback (Cairo.Context ctx) {
125
120
            var new_w  = entry.menu.get_parent ().get_allocated_width ();
126
121
            var new_h = entry.menu.get_parent ().get_allocated_height ();
160
155
            // now paint our buffer on
161
156
            ctx.set_source_surface (buffer.surface, 0, 0);
162
157
            ctx.paint ();
163
 
            
 
158
 
164
159
            return false;
165
160
        }
166
161
 
192
187
 
193
188
            buffer.context.arc (x + w - radius, y + h - radius, radius, 0, Math.PI * 0.5);
194
189
            buffer.context.arc (x + radius, y + h - radius, radius, Math.PI * 0.5, Math.PI);
195
 
            
 
190
 
196
191
            buffer.context.close_path ();
197
192
        }
198
193