Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 266402 | Differences between
and this patch

Collapse All | Expand All

(-)a/katze/katze-arrayaction.c (-11 / +59 lines)
Lines 24-29 struct _KatzeArrayAction Link Here
24
24
25
    KatzeArray* array;
25
    KatzeArray* array;
26
    KatzeNet* net;
26
    KatzeNet* net;
27
28
    gboolean* reversed;
27
};
29
};
28
30
29
struct _KatzeArrayActionClass
31
struct _KatzeArrayActionClass
Lines 37-43 enum Link Here
37
{
39
{
38
    PROP_0,
40
    PROP_0,
39
41
40
    PROP_ARRAY
42
    PROP_ARRAY,
43
    PROP_REVERSED
41
};
44
};
42
45
43
enum
46
enum
Lines 127-132 katze_array_action_class_init (KatzeArrayActionClass* class) Link Here
127
                                     "The array the action represents",
130
                                     "The array the action represents",
128
                                     KATZE_TYPE_ARRAY,
131
                                     KATZE_TYPE_ARRAY,
129
                                     G_PARAM_READWRITE));
132
                                     G_PARAM_READWRITE));
133
134
    g_object_class_install_property (gobject_class,
135
                                     PROP_REVERSED,
136
                                     g_param_spec_boolean (
137
                                     "reversed",
138
                                     "Reversed",
139
                                     "Whether the array should be walked " \
140
                                     "backwards when building menus",
141
                                     FALSE,
142
                                     G_PARAM_READWRITE));
130
}
143
}
131
144
132
static void
145
static void
Lines 134-139 katze_array_action_init (KatzeArrayAction* array_action) Link Here
134
{
147
{
135
    array_action->array = NULL;
148
    array_action->array = NULL;
136
    array_action->net = katze_net_new ();
149
    array_action->net = katze_net_new ();
150
    array_action->reversed = FALSE;
137
}
151
}
138
152
139
static void
153
static void
Lines 143-148 katze_array_action_finalize (GObject* object) Link Here
143
157
144
    katze_object_assign (array_action->array, NULL);
158
    katze_object_assign (array_action->array, NULL);
145
    katze_object_assign (array_action->net, NULL);
159
    katze_object_assign (array_action->net, NULL);
160
    katze_object_assign (array_action->reversed, NULL);
146
161
147
    G_OBJECT_CLASS (katze_array_action_parent_class)->finalize (object);
162
    G_OBJECT_CLASS (katze_array_action_parent_class)->finalize (object);
148
}
163
}
Lines 153-158 katze_array_action_set_property (GObject* object, Link Here
153
                                 const GValue* value,
168
                                 const GValue* value,
154
                                 GParamSpec*   pspec)
169
                                 GParamSpec*   pspec)
155
{
170
{
171
    gboolean reversed;
156
    KatzeArrayAction* array_action = KATZE_ARRAY_ACTION (object);
172
    KatzeArrayAction* array_action = KATZE_ARRAY_ACTION (object);
157
173
158
    switch (prop_id)
174
    switch (prop_id)
Lines 160-165 katze_array_action_set_property (GObject* object, Link Here
160
    case PROP_ARRAY:
176
    case PROP_ARRAY:
161
        katze_array_action_set_array (array_action, g_value_get_object (value));
177
        katze_array_action_set_array (array_action, g_value_get_object (value));
162
        break;
178
        break;
179
    case PROP_REVERSED:
180
        reversed = g_value_get_boolean (value);
181
        array_action->reversed = &reversed;
182
        break;
163
    default:
183
    default:
164
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
184
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
165
        break;
185
        break;
Lines 179-184 katze_array_action_get_property (GObject* object, Link Here
179
    case PROP_ARRAY:
199
    case PROP_ARRAY:
180
        g_value_set_object (value, array_action->array);
200
        g_value_set_object (value, array_action->array);
181
        break;
201
        break;
202
    case PROP_REVERSED:
203
        g_value_set_boolean (value, *array_action->reversed);
204
        break;
182
    default:
205
    default:
183
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
206
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
184
        break;
207
        break;
Lines 218-246 katze_array_action_menu_item_select_cb (GtkWidget* proxy, Link Here
218
                                        KatzeArrayAction* array_action);
241
                                        KatzeArrayAction* array_action);
219
242
220
static void
243
static void
221
katze_array_action_generate_menu (KatzeArrayAction* array_action,
244
katze_array_action_add_menu_item (KatzeArrayAction* array_action,
222
                                  KatzeArray*       array,
245
                                  KatzeItem*        item,
223
                                  GtkWidget*        menu,
246
                                  GtkWidget*        menu,
224
                                  GtkWidget*        proxy)
247
                                  GtkWidget*        proxy)
225
{
248
{
226
    guint i;
227
    KatzeItem* item;
228
    GtkWidget* menuitem;
249
    GtkWidget* menuitem;
229
    const gchar* icon_name;
250
    const gchar* icon_name;
230
    GdkPixbuf* icon;
251
    GdkPixbuf* icon;
231
    GtkWidget* image;
252
    GtkWidget* image;
232
    GtkWidget* submenu;
253
    GtkWidget* submenu;
233
254
234
    i = 0;
235
    while ((item = katze_array_get_nth_item (array, i++)))
236
    {
237
        /* FIXME: The menu item should reflect changes to the item  */
255
        /* FIXME: The menu item should reflect changes to the item  */
238
        if (!KATZE_IS_ARRAY (item) && !katze_item_get_uri (item))
256
        if (!KATZE_IS_ARRAY (item) && !katze_item_get_uri (item))
239
        {
257
        {
240
            menuitem = gtk_separator_menu_item_new ();
258
            menuitem = gtk_separator_menu_item_new ();
241
            gtk_widget_show (menuitem);
259
            gtk_widget_show (menuitem);
242
            gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
260
            gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
243
            continue;
261
        return;
244
        }
262
        }
245
        menuitem = katze_image_menu_item_new_ellipsized (
263
        menuitem = katze_image_menu_item_new_ellipsized (
246
            katze_item_get_name (item));
264
            katze_item_get_name (item));
Lines 271-283 katze_array_action_generate_menu (KatzeArrayAction* array_action, Link Here
271
            g_signal_connect (menuitem, "activate",
289
            g_signal_connect (menuitem, "activate",
272
                G_CALLBACK (katze_array_action_menu_item_activate_cb), array_action);
290
                G_CALLBACK (katze_array_action_menu_item_activate_cb), array_action);
273
        gtk_widget_show (menuitem);
291
        gtk_widget_show (menuitem);
274
    }
292
275
    if (!i)
293
}
294
295
static void
296
katze_array_action_generate_menu (KatzeArrayAction* array_action,
297
                                  KatzeArray*       array,
298
                                  GtkWidget*        menu,
299
                                  GtkWidget*        proxy)
300
{
301
    guint i;
302
    KatzeItem* item;
303
    GtkWidget* menuitem;
304
305
    if (katze_array_is_empty (array))
276
    {
306
    {
277
        menuitem = gtk_image_menu_item_new_with_label (_("Empty"));
307
        menuitem = gtk_image_menu_item_new_with_label (_("Empty"));
278
        gtk_widget_set_sensitive (menuitem, FALSE);
308
        gtk_widget_set_sensitive (menuitem, FALSE);
279
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
309
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
280
        gtk_widget_show (menuitem);
310
        gtk_widget_show (menuitem);
311
        return;
312
    }
313
314
    if (array_action->reversed)
315
    {
316
        i = katze_array_get_length (array);
317
        while ((item = katze_array_get_nth_item (array, --i)))
318
        {
319
            katze_array_action_add_menu_item (array_action, item, menu, proxy);
320
        }
321
    }
322
    else
323
    {
324
        i = 0;
325
        while ((item = katze_array_get_nth_item (array, i++)))
326
        {
327
            katze_array_action_add_menu_item (array_action, item, menu, proxy);
328
        }
281
    }
329
    }
282
}
330
}
283
331
(-)a/midori/midori-browser.c (-6 / +14 lines)
Lines 3832-3844 midori_browser_set_history (MidoriBrowser* browser, Link Here
3832
3832
3833
    midori_browser_history_clear_cb (history, browser);
3833
    midori_browser_history_clear_cb (history, browser);
3834
3834
3835
    action = _action_by_name (browser, "RecentlyVisited");
3836
3835
    if (history && ((recently_visited = katze_array_get_nth_item (history,
3837
    if (history && ((recently_visited = katze_array_get_nth_item (history,
3836
        katze_array_get_length (KATZE_ARRAY (history)) - 1))))
3838
        katze_array_get_length (KATZE_ARRAY (history)) - 1))))
3837
        g_object_set (_action_by_name (browser, "RecentlyVisited"),
3839
        g_object_set (action,
3838
                      "array", recently_visited, NULL);
3840
                      "reversed", TRUE,
3841
                      "array", recently_visited,
3842
                      NULL);
3839
    else
3843
    else
3840
        g_object_set (_action_by_name (browser, "RecentlyVisited"),
3844
        g_object_set (action,
3841
                      "array", NULL, NULL);
3845
                      "reversed", FALSE,
3846
                      "array", NULL,
3847
                      NULL);
3842
3848
3843
    if (!history)
3849
    if (!history)
3844
        return;
3850
        return;
Lines 4696-4703 midori_browser_set_property (GObject* object, Link Here
4696
    case PROP_TRASH:
4702
    case PROP_TRASH:
4697
        /* FIXME: Disconnect handlers */
4703
        /* FIXME: Disconnect handlers */
4698
        katze_object_assign (browser->trash, g_value_dup_object (value));
4704
        katze_object_assign (browser->trash, g_value_dup_object (value));
4699
        g_object_set (_action_by_name (browser, "Trash"), "array",
4705
        g_object_set (_action_by_name (browser, "Trash"),
4700
            browser->trash, NULL);
4706
                      "reversed", TRUE,
4707
                      "array", browser->trash,
4708
                      NULL);
4701
        /* FIXME: Connect to updates */
4709
        /* FIXME: Connect to updates */
4702
        _midori_browser_update_actions (browser);
4710
        _midori_browser_update_actions (browser);
4703
        break;
4711
        break;

Return to bug 266402