Example #1
0
static void
gtk_image_menu_item_sync_action_properties (GtkActivatable *activatable,
        GtkAction      *action)
{
    GtkImageMenuItem *image_menu_item;
    gboolean   use_appearance;

    image_menu_item = GTK_IMAGE_MENU_ITEM (activatable);

    parent_activatable_iface->sync_action_properties (activatable, action);

    if (!action)
        return;

    use_appearance = gtk_activatable_get_use_action_appearance (activatable);
    if (!use_appearance)
        return;

    if (!activatable_update_stock_id (image_menu_item, action) &&
            !activatable_update_gicon (image_menu_item, action))
        activatable_update_icon_name (image_menu_item, action);

    gtk_image_menu_item_set_always_show_image (image_menu_item,
            gtk_action_get_always_show_image (action));
}
static void
nemo_context_menu_menu_item_update (GtkActivatable *activatable,
                                    GtkAction      *action,
                                    const gchar    *property_name)
{
    if (!gtk_activatable_get_use_action_appearance (activatable))
        return;
    if (strcmp (property_name, "label") == 0)
        activatable_update_label (GTK_MENU_ITEM (activatable), action);
    else if (strcmp (property_name, "stock-id") == 0)
        activatable_update_stock_id (GTK_IMAGE_MENU_ITEM (activatable), action);
    else if (strcmp (property_name, "gicon") == 0)
        activatable_update_gicon (GTK_IMAGE_MENU_ITEM (activatable), action);
    else if (strcmp (property_name, "icon-name") == 0)
        activatable_update_icon_name (GTK_IMAGE_MENU_ITEM (activatable), action);
}
static void
menu_item_sync_action_properties (NemoContextMenuMenuItem *menu_item,
                                  GtkAction               *action)
{
    GtkImageMenuItem *image_menu_item;
    GtkActivatable *activatable;
    GtkWidget *image;
    gboolean   use_appearance;

    image_menu_item = GTK_IMAGE_MENU_ITEM (menu_item);

    activatable = GTK_ACTIVATABLE (image_menu_item);

    if (!action)
        return;

    use_appearance = gtk_activatable_get_use_action_appearance (activatable);
    if (!use_appearance)
        return;

    image = gtk_image_menu_item_get_image (image_menu_item);
    if (image && !GTK_IS_IMAGE (image)) {
        gtk_image_menu_item_set_image (image_menu_item, NULL);
        image = NULL;
    }

    if (!image) {
        image = gtk_image_new ();
        gtk_widget_show (image);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (activatable),
                                       image);
    }

    if (!activatable_update_stock_id (image_menu_item, action) &&
        !activatable_update_gicon (image_menu_item, action))
        activatable_update_icon_name (image_menu_item, action);

    gtk_image_menu_item_set_always_show_image (image_menu_item,
                                               gtk_action_get_always_show_image (action));

    activatable_update_label (GTK_MENU_ITEM (menu_item), action);
}
Example #4
0
static void
gtk_image_menu_item_sync_action_properties (GtkActivatable *activatable,
        GtkAction      *action)
{
    GtkImageMenuItem *image_menu_item;
    GtkWidget *image;
    gboolean   use_appearance;

    image_menu_item = GTK_IMAGE_MENU_ITEM (activatable);

    parent_activatable_iface->sync_action_properties (activatable, action);

    if (!action)
        return;

    use_appearance = gtk_activatable_get_use_action_appearance (activatable);
    if (!use_appearance)
        return;

    image = gtk_image_menu_item_get_image (image_menu_item);
    if (image && !GTK_IS_IMAGE (image))
    {
        gtk_image_menu_item_set_image (image_menu_item, NULL);
        image = NULL;
    }

    if (!image)
    {
        image = gtk_image_new ();
        gtk_widget_show (image);
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (activatable),
                                       image);
    }

    if (!activatable_update_stock_id (image_menu_item, action) &&
            !activatable_update_gicon (image_menu_item, action))
        activatable_update_icon_name (image_menu_item, action);

}
Example #5
0
static void
gtk_image_menu_item_update (GtkActivatable *activatable,
                            GtkAction      *action,
                            const gchar    *property_name)
{
    GtkImageMenuItem *image_menu_item;
    gboolean   use_appearance;

    image_menu_item = GTK_IMAGE_MENU_ITEM (activatable);

    parent_activatable_iface->update (activatable, action, property_name);

    use_appearance = gtk_activatable_get_use_action_appearance (activatable);
    if (!use_appearance)
        return;

    if (strcmp (property_name, "stock-id") == 0)
        activatable_update_stock_id (image_menu_item, action);
    else if (strcmp (property_name, "gicon") == 0)
        activatable_update_gicon (image_menu_item, action);
    else if (strcmp (property_name, "icon-name") == 0)
        activatable_update_icon_name (image_menu_item, action);
}