Beispiel #1
0
static void tb_editor_set_item_values(TBEditorWidget *tbw, const gchar *action_name,
									  GtkListStore *store, GtkTreeIter *iter)
{
	gchar *icon = NULL;
	gchar *label = NULL;
	gchar *label_clean = NULL;
	GtkAction *action;

	action = gtk_action_group_get_action(tbw->action_group, action_name);
	if (action != NULL)
	{
		icon = katze_object_get_string(action, "icon-name");
		if (icon == NULL)
		{
			icon = katze_object_get_string(action, "stock-id");
		}

		label = katze_object_get_string(action, "label");
		if (label != NULL)
			label_clean = katze_strip_mnemonics(label);
	}

	gtk_list_store_set(store, iter,
		TB_EDITOR_COL_ACTION, action_name,
		TB_EDITOR_COL_LABEL, label_clean,
		TB_EDITOR_COL_ICON, icon,
		-1);

	g_free(icon);
	g_free(label);
	g_free(label_clean);
}
Beispiel #2
0
static gchar*
shortcuts_label_for_action (GtkAction* action)
{
    gchar* label;
    gchar* stripped;

    if ((label = katze_object_get_string (action, "label")))
        stripped = katze_strip_mnemonics (label);
    else
    {
        GtkStockItem item;

        g_object_get (action, "stock-id", &label, NULL);
        if (gtk_stock_lookup (label, &item))
            stripped = katze_strip_mnemonics (item.label);
        else
            stripped = g_strdup ("");
    }

    g_free (label);
    return stripped;
}
static void tb_editor_set_item_values(TBEditorWidget *tbw, const gchar *action_name,
                                      GtkListStore *store, GtkTreeIter *iter)
{
    gchar *icon = NULL;
    gchar *label = NULL;
    gchar *label_clean = NULL;
    GdkPixbuf *pix = NULL;
    GtkAction *action;

    action = gtk_action_group_get_action(marlin_view_window_get_actiongroup(tbw->mvw), action_name);

    if (action != NULL)
    {
        /*gtk_action_block_activate(action);
          log_printf (LOG_LEVEL_UNDEFINED, "blocked %s\n", action_name);*/
        icon = katze_object_get_string(action, "icon-name");
        if (icon == NULL)
        {
            icon = katze_object_get_string(action, "stock-id");
        }

        label = katze_object_get_string(action, "label");
        if (label != NULL)
            label_clean = katze_strip_mnemonics(label);
    }
    else
        label_clean = strdup(action_name);


    GtkIconTheme *icon_theme = gtk_icon_theme_get_default ();
    /*GtkIconInfo *icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon, 16,
      GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_FORCE_SIZE);
      gchar *test;
      test = gtk_icon_info_get_filename (icon_info);
    //log_printf (LOG_LEVEL_UNDEFINED, "action: %20s icon: %20s\n", action_name, icon);
    log_printf (LOG_LEVEL_UNDEFINED, "action: %20s icon: %20s test: %s\n", action_name, icon, test);*/


    if (icon != NULL)
    {
        //GtkIconSize status_btn_size = gtk_icon_size_from_name ("16px");
        GtkWidget *image = gtk_image_new ();
        //pix = gtk_widget_render_icon (image, icon, status_btn_size, NULL);
        pix = gtk_widget_render_icon (image, icon, GTK_ICON_SIZE_MENU, NULL);
        gtk_widget_destroy (image);

        if (pix==NULL && icon!=NULL)
            pix = gtk_icon_theme_load_icon (icon_theme, icon, 16,
                                            GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK | GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
    }

    gtk_list_store_set(store, iter,
                       TB_EDITOR_COL_ACTION, action_name,
                       TB_EDITOR_COL_LABEL, label_clean,
                       //TB_EDITOR_COL_LABEL, action_name,
                       TB_EDITOR_COL_ICON, pix,
                       -1);

    g_free(icon);
    g_free(label);
    g_free(label_clean);
}