[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 165/473: Use tabs for configuration dialog layout.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:55:35 CET 2015
This is an automated email from the git hooks/post-receive script.
gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit 10cc4aa6e76a0c3405c442bf6e413d49373181f0
Author: Graeme Gott <graeme at gottcode.org>
Date: Sun Sep 22 11:18:23 2013 -0400
Use tabs for configuration dialog layout.
---
src/configuration_dialog.cpp | 304 +++++++++++++++++++++++-------------------
src/configuration_dialog.hpp | 3 +
2 files changed, 172 insertions(+), 135 deletions(-)
diff --git a/src/configuration_dialog.cpp b/src/configuration_dialog.cpp
index 9c3da54..09255e3 100644
--- a/src/configuration_dialog.cpp
+++ b/src/configuration_dialog.cpp
@@ -59,17 +59,155 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
g_signal_connect(m_window, "response", G_CALLBACK(ConfigurationDialog::response_slot), this);
g_signal_connect_swapped(m_window, "destroy", G_CALLBACK(whiskermenu_config_dialog_delete), this);
- // Fetch contents box
- GtkBox* contents_vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(m_window)));
+ // Create tabs
+ GtkNotebook* notebook = GTK_NOTEBOOK(gtk_notebook_new());
+ gtk_notebook_append_page(notebook, init_appearance_tab(), gtk_label_new_with_mnemonic("_Appearance"));
+ gtk_notebook_append_page(notebook, init_panel_button_tab(), gtk_label_new_with_mnemonic("_Panel Button"));
+ gtk_notebook_append_page(notebook, init_behavior_tab(), gtk_label_new_with_mnemonic("_Behavior"));
+
+ // Add tabs to dialog
+ GtkBox* vbox = GTK_BOX(gtk_vbox_new(false, 8));
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
+ gtk_box_pack_start(vbox, GTK_WIDGET(notebook), true, true, 0);
+ GtkBox* contents = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(m_window)));
+ gtk_box_pack_start(contents, GTK_WIDGET(vbox), true, true, 0);
+ // Show GTK window
+ gtk_widget_show_all(m_window);
+
+ m_plugin->set_configure_enabled(false);
+}
+
+//-----------------------------------------------------------------------------
+
+ConfigurationDialog::~ConfigurationDialog()
+{
+ m_plugin->set_configure_enabled(true);
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::choose_icon()
+{
+ GtkWidget* chooser = exo_icon_chooser_dialog_new(_("Select An Icon"),
+ GTK_WINDOW(m_window),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ gtk_dialog_set_default_response(GTK_DIALOG(chooser), GTK_RESPONSE_ACCEPT);
+ gtk_dialog_set_alternative_button_order(GTK_DIALOG(chooser),
+ GTK_RESPONSE_ACCEPT,
+ GTK_RESPONSE_CANCEL, -1);
+ exo_icon_chooser_dialog_set_icon(EXO_ICON_CHOOSER_DIALOG(chooser), m_plugin->get_button_icon_name().c_str());
+
+ if (gtk_dialog_run(GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT)
+ {
+ gchar* icon = exo_icon_chooser_dialog_get_icon(EXO_ICON_CHOOSER_DIALOG(chooser));
+ xfce_panel_image_set_from_source(XFCE_PANEL_IMAGE(m_icon), icon);
+ m_plugin->set_button_icon_name(icon);
+ g_free(icon);
+ }
+
+ gtk_widget_destroy(chooser);
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::category_icon_size_changed(GtkComboBox* combo)
+{
+ SectionButton::set_icon_size(gtk_combo_box_get_active(combo));
+ m_plugin->reload();
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::item_icon_size_changed(GtkComboBox* combo)
+{
+ LauncherView::set_icon_size(gtk_combo_box_get_active(combo));
+ m_plugin->reload();
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::style_changed(GtkComboBox* combo)
+{
+ m_plugin->set_button_style(PanelPlugin::ButtonStyle(gtk_combo_box_get_active(combo) + 1));
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::title_changed()
+{
+ const gchar* text = gtk_entry_get_text(GTK_ENTRY(m_title));
+ m_plugin->set_button_title(text ? text : "");
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::toggle_hover_switch_category(GtkToggleButton* button)
+{
+ SectionButton::set_hover_activate(gtk_toggle_button_get_active(button));
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::toggle_show_name(GtkToggleButton* button)
+{
+ Launcher::set_show_name(gtk_toggle_button_get_active(button));
+ m_plugin->reload();
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::toggle_show_description(GtkToggleButton* button)
+{
+ Launcher::set_show_description(gtk_toggle_button_get_active(button));
+ m_plugin->reload();
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::toggle_load_hierarchy(GtkToggleButton* button)
+{
+ ApplicationsPage::set_load_hierarchy(gtk_toggle_button_get_active(button));
+ m_plugin->reload();
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::toggle_remember_favorites(GtkToggleButton* button)
+{
+ FavoritesPage::set_remember_favorites(gtk_toggle_button_get_active(button));
+}
+
+//-----------------------------------------------------------------------------
+
+void ConfigurationDialog::response(int response_id)
+{
+ if ((m_plugin->get_button_style() == PanelPlugin::ShowText) && m_plugin->get_button_title().empty())
+ {
+ m_plugin->set_button_title(PanelPlugin::get_button_title_default());
+ }
+
+ if (response_id == GTK_RESPONSE_CLOSE)
+ {
+ gtk_widget_destroy(m_window);
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+GtkWidget* ConfigurationDialog::init_appearance_tab()
+{
// Create size group for labels
GtkSizeGroup* label_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
// Create appearance section
+ GtkWidget* page = gtk_alignment_new(0, 0, 1, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(page), 8);
GtkBox* appearance_vbox = GTK_BOX(gtk_vbox_new(false, 8));
- GtkWidget* appearance_frame = xfce_gtk_frame_box_new_with_content(_("Appearance"), GTK_WIDGET(appearance_vbox));
- gtk_box_pack_start(contents_vbox, appearance_frame, false, false, 0);
- gtk_container_set_border_width(GTK_CONTAINER(appearance_frame), 6);
+ gtk_container_add(GTK_CONTAINER(page), GTK_WIDGET(appearance_vbox));
// Add option to use generic names
m_show_names = gtk_check_button_new_with_mnemonic(_("Show applications by _name"));
@@ -122,17 +260,27 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
gtk_label_set_mnemonic_widget(GTK_LABEL(label), m_category_icon_size);
g_signal_connect(m_category_icon_size, "changed", G_CALLBACK(ConfigurationDialog::category_icon_size_changed_slot), this);
+ return page;
+}
+
+//-----------------------------------------------------------------------------
+
+GtkWidget* ConfigurationDialog::init_panel_button_tab()
+{
+ // Create size group for labels
+ GtkSizeGroup* label_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
// Create panel button section
+ GtkWidget* page = gtk_alignment_new(0, 0, 1, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(page), 8);
GtkBox* panel_vbox = GTK_BOX(gtk_vbox_new(false, 8));
- GtkWidget* panel_frame = xfce_gtk_frame_box_new_with_content(_("Panel Button"), GTK_WIDGET(panel_vbox));
- gtk_box_pack_start(contents_vbox, panel_frame, false, false, 0);
- gtk_container_set_border_width(GTK_CONTAINER(panel_frame), 6);
+ gtk_container_add(GTK_CONTAINER(page), GTK_WIDGET(panel_vbox));
// Add button style selector
- hbox = GTK_BOX(gtk_hbox_new(false, 12));
+ GtkBox* hbox = GTK_BOX(gtk_hbox_new(false, 12));
gtk_box_pack_start(panel_vbox, GTK_WIDGET(hbox), false, false, 0);
- label = gtk_label_new_with_mnemonic(_("Di_splay:"));
+ GtkWidget* label = gtk_label_new_with_mnemonic(_("Di_splay:"));
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
gtk_box_pack_start(hbox, label, false, false, 0);
gtk_size_group_add_widget(label_size_group, label);
@@ -179,11 +327,18 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
xfce_panel_image_set_size(XFCE_PANEL_IMAGE(m_icon), 48);
gtk_container_add(GTK_CONTAINER(m_icon_button), m_icon);
+ return page;
+}
+
+//-----------------------------------------------------------------------------
+
+GtkWidget* ConfigurationDialog::init_behavior_tab()
+{
// Create behavior section
+ GtkWidget* page = gtk_alignment_new(0, 0, 1, 0);
+ gtk_container_set_border_width(GTK_CONTAINER(page), 8);
GtkBox* behavior_vbox = GTK_BOX(gtk_vbox_new(false, 8));
- GtkWidget* behavior_frame = xfce_gtk_frame_box_new_with_content(_("Behavior"), GTK_WIDGET(behavior_vbox));
- gtk_box_pack_start(contents_vbox, behavior_frame, false, false, 0);
- gtk_container_set_border_width(GTK_CONTAINER(behavior_frame), 6);
+ gtk_container_add(GTK_CONTAINER(page), GTK_WIDGET(behavior_vbox));
// Add option to use generic names
m_hover_switch_category = gtk_check_button_new_with_mnemonic(_("Switch categories by _hovering"));
@@ -203,128 +358,7 @@ ConfigurationDialog::ConfigurationDialog(PanelPlugin* plugin) :
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_remember_favorites), FavoritesPage::get_remember_favorites());
g_signal_connect(m_remember_favorites, "toggled", G_CALLBACK(ConfigurationDialog::toggle_remember_favorites_slot), this);
- // Show GTK window
- gtk_widget_show_all(m_window);
-
- m_plugin->set_configure_enabled(false);
-}
-
-//-----------------------------------------------------------------------------
-
-ConfigurationDialog::~ConfigurationDialog()
-{
- m_plugin->set_configure_enabled(true);
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::choose_icon()
-{
- GtkWidget* chooser = exo_icon_chooser_dialog_new(_("Select An Icon"),
- GTK_WINDOW(m_window),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- NULL);
-
- gtk_dialog_set_default_response(GTK_DIALOG(chooser), GTK_RESPONSE_ACCEPT);
- gtk_dialog_set_alternative_button_order(GTK_DIALOG(chooser),
- GTK_RESPONSE_ACCEPT,
- GTK_RESPONSE_CANCEL, -1);
- exo_icon_chooser_dialog_set_icon(EXO_ICON_CHOOSER_DIALOG(chooser), m_plugin->get_button_icon_name().c_str());
-
- if (gtk_dialog_run(GTK_DIALOG (chooser)) == GTK_RESPONSE_ACCEPT)
- {
- gchar* icon = exo_icon_chooser_dialog_get_icon(EXO_ICON_CHOOSER_DIALOG(chooser));
- xfce_panel_image_set_from_source(XFCE_PANEL_IMAGE(m_icon), icon);
- m_plugin->set_button_icon_name(icon);
- g_free(icon);
- }
-
- gtk_widget_destroy(chooser);
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::category_icon_size_changed(GtkComboBox* combo)
-{
- SectionButton::set_icon_size(gtk_combo_box_get_active(combo));
- m_plugin->reload();
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::item_icon_size_changed(GtkComboBox* combo)
-{
- LauncherView::set_icon_size(gtk_combo_box_get_active(combo));
- m_plugin->reload();
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::style_changed(GtkComboBox* combo)
-{
- m_plugin->set_button_style(PanelPlugin::ButtonStyle(gtk_combo_box_get_active(combo) + 1));
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::title_changed()
-{
- const gchar* text = gtk_entry_get_text(GTK_ENTRY(m_title));
- m_plugin->set_button_title(text ? text : "");
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::toggle_hover_switch_category(GtkToggleButton* button)
-{
- SectionButton::set_hover_activate(gtk_toggle_button_get_active(button));
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::toggle_show_name(GtkToggleButton* button)
-{
- Launcher::set_show_name(gtk_toggle_button_get_active(button));
- m_plugin->reload();
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::toggle_show_description(GtkToggleButton* button)
-{
- Launcher::set_show_description(gtk_toggle_button_get_active(button));
- m_plugin->reload();
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::toggle_load_hierarchy(GtkToggleButton* button)
-{
- ApplicationsPage::set_load_hierarchy(gtk_toggle_button_get_active(button));
- m_plugin->reload();
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::toggle_remember_favorites(GtkToggleButton* button)
-{
- FavoritesPage::set_remember_favorites(gtk_toggle_button_get_active(button));
-}
-
-//-----------------------------------------------------------------------------
-
-void ConfigurationDialog::response(int response_id)
-{
- if ((m_plugin->get_button_style() == PanelPlugin::ShowText) && m_plugin->get_button_title().empty())
- {
- m_plugin->set_button_title(PanelPlugin::get_button_title_default());
- }
-
- if (response_id == GTK_RESPONSE_CLOSE)
- {
- gtk_widget_destroy(m_window);
- }
+ return page;
}
//-----------------------------------------------------------------------------
diff --git a/src/configuration_dialog.hpp b/src/configuration_dialog.hpp
index 775c313..02403b9 100644
--- a/src/configuration_dialog.hpp
+++ b/src/configuration_dialog.hpp
@@ -50,6 +50,9 @@ private:
void toggle_load_hierarchy(GtkToggleButton* button);
void toggle_remember_favorites(GtkToggleButton* button);
void response(int response_id);
+ GtkWidget* init_appearance_tab();
+ GtkWidget* init_panel_button_tab();
+ GtkWidget* init_behavior_tab();
private:
PanelPlugin* m_plugin;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list