--- xfdesktop-4.6.2~/panel-plugin/desktop-menu-plugin.c 2010-05-21 19:01:35.000000000 +0200 +++ xfdesktop-4.6.2/panel-plugin/desktop-menu-plugin.c 2010-11-22 12:16:29.236000175 +0100 @@ -83,7 +83,9 @@ gboolean show_menu_icons; gchar *button_title; gboolean show_button_title; + gboolean show_button_icon; + GtkWidget *combo; GtkWidget *file_entry; GtkWidget *icon_entry; GtkWidget *icons_chk; @@ -161,7 +163,7 @@ DBG("wsize: %d, size: %d", wsize, size); - if(dmp->icon_file) { + if(dmp->show_button_icon && dmp->icon_file) { GdkPixbuf *pix = dmp_get_icon(dmp->icon_file, size, orientation); if(pix) { pix_w = gdk_pixbuf_get_width(pix); @@ -187,7 +189,7 @@ } } - if(dmp->icon_file && dmp->show_button_title) { + if(dmp->show_button_icon && dmp->icon_file && dmp->show_button_title) { gint delta = gtk_box_get_spacing(GTK_BOX(dmp->box)); if(orientation == GTK_ORIENTATION_HORIZONTAL) @@ -206,7 +208,7 @@ GtkOrientation orientation, DMPlugin *dmp) { - if(!dmp->show_button_title) + if(!dmp->show_button_title && !dmp->show_button_icon) return; gtk_widget_set_size_request(dmp->button, -1, -1); @@ -231,15 +233,24 @@ } static void -show_title_toggled_cb(GtkToggleButton *tb, gpointer user_data) +combo_show_cb(GtkComboBox *combo, gpointer user_data) { - DMPlugin *dmp = user_data; - - dmp->show_button_title = gtk_toggle_button_get_active(tb); - - if(dmp->show_button_title) - dmp_set_orientation(dmp->plugin, xfce_panel_plugin_get_orientation(dmp->plugin), dmp); - else { + DMPlugin *dmp = user_data; + + gint option = gtk_combo_box_get_active(combo); + + g_assert(dmp != NULL); + g_assert(option >= 0 && option <= 2); + + dmp->show_button_icon = (option == 0 || option == 2); + dmp->show_button_title = (option == 1 || option == 2); + + dmp_set_orientation(dmp->plugin, xfce_panel_plugin_get_orientation(dmp->plugin), dmp); + if(! dmp->show_button_icon) { + gtk_widget_hide(dmp->image); + dmp_set_size(dmp->plugin, xfce_panel_plugin_get_size(dmp->plugin), dmp); + } + if(! dmp->show_button_title) { gtk_widget_hide(dmp->label); dmp_set_size(dmp->plugin, xfce_panel_plugin_get_size(dmp->plugin), dmp); } @@ -435,8 +446,9 @@ dmp->menu_file = NULL; dmp->icon_file = g_strdup(DEFAULT_BUTTON_ICON); dmp->show_menu_icons = TRUE; - dmp->button_title = g_strdup(_(DEFAULT_BUTTON_TITLE)); + dmp->show_button_icon = TRUE; dmp->show_button_title = TRUE; + dmp->button_title = g_strdup(_(DEFAULT_BUTTON_TITLE)); } static void @@ -478,6 +490,9 @@ dmp->show_menu_icons = xfce_rc_read_bool_entry(rcfile, "show_menu_icons", TRUE); + + dmp->show_button_icon = xfce_rc_read_bool_entry(rcfile, "show_button_icon", + TRUE); value = xfce_rc_read_entry(rcfile, "button_title", NULL); if(value) { @@ -509,6 +524,7 @@ xfce_rc_write_entry(rcfile, "menu_file", dmp->menu_file ? dmp->menu_file : ""); xfce_rc_write_entry(rcfile, "icon_file", dmp->icon_file ? dmp->icon_file : ""); xfce_rc_write_bool_entry(rcfile, "show_menu_icons", dmp->show_menu_icons); + xfce_rc_write_bool_entry(rcfile, "show_button_icon", dmp->show_button_icon); xfce_rc_write_entry(rcfile, "button_title", dmp->button_title ? dmp->button_title : ""); xfce_rc_write_bool_entry(rcfile, "show_button_title", dmp->show_button_title); @@ -737,7 +753,8 @@ dmp_create_options(XfcePanelPlugin *plugin, DMPlugin *dmp) { GtkWidget *dlg, *topvbox, *vbox, *hbox, *frame, *frame_bin, *spacer; - GtkWidget *label, *chk, *radio, *entry; + GtkWidget *label, *chk, *radio, *entry, *combo; + gint active; xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8"); @@ -768,6 +785,36 @@ gtk_widget_show(hbox); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("_Show")); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + + combo = gtk_combo_box_new_text(); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), combo); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Icon Only")); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Label Only")); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Icon and Label")); + + if(dmp->show_button_title) + if(dmp->show_button_icon) + active = 2; + else + active = 1; + else + active = 0; + gtk_combo_box_set_active(GTK_COMBO_BOX(combo), active); + + g_signal_connect(G_OBJECT(combo), "changed", + G_CALLBACK(combo_show_cb), dmp); + + gtk_widget_show(combo); + gtk_box_pack_start(GTK_BOX(hbox), combo, FALSE, FALSE, 0); + + hbox = gtk_hbox_new(FALSE, BORDER / 2); + gtk_container_set_border_width(GTK_CONTAINER(hbox), BORDER / 2); + gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(_("Button _title:")); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -781,13 +828,6 @@ g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(dmp_button_title_focus_out_cb), dmp); - chk = gtk_check_button_new_with_mnemonic(_("_Show title in button")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chk), dmp->show_button_title); - gtk_widget_show(chk); - gtk_box_pack_start(GTK_BOX(vbox), chk, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(chk), "toggled", - G_CALLBACK(show_title_toggled_cb), dmp); - frame = xfce_create_framebox(_("Menu File"), &frame_bin); gtk_widget_show(frame); gtk_box_pack_start(GTK_BOX(topvbox), frame, FALSE, FALSE, 0); @@ -985,7 +1025,8 @@ dmp->image = gtk_image_new(); g_object_ref(G_OBJECT(dmp->image)); - gtk_widget_show(dmp->image); + if(dmp->show_button_icon) + gtk_widget_show(dmp->image); gtk_box_pack_start(GTK_BOX(dmp->box), dmp->image, TRUE, TRUE, 0); dmp->label = gtk_label_new(dmp->button_title);