Skip to content

Commit

Permalink
Merge pull request #581 from techee/symbollist_sort
Browse files Browse the repository at this point in the history
Make it possible to define default symbol_list_sort_mode
  • Loading branch information
b4n committed Jan 13, 2016
2 parents e7429d4 + 1ea072e commit 6e0d4ac
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 6 deletions.
68 changes: 66 additions & 2 deletions data/geany.glade
Expand Up @@ -1543,7 +1543,7 @@
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkVBox" id="vbox46">
<object class="GtkVBox" id="box_sidebar_visible_children">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
Expand All @@ -1555,13 +1555,77 @@
<property name="tooltip_text" translatable="yes">Toggle the symbol list on and off</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_show_symbol_list_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkAlignment" id="alignment15">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<child>
<object class="GtkHBox" id="box_show_symbol_list_children">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Default symbol sorting mode</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label24">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Default sorting mode:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio_symbols_sort_by_name">
<property name="label" translatable="yes">Name</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio_symbols_sort_by_appearance">
<property name="label" translatable="yes">Appearance</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">radio_symbols_sort_by_name</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="check_list_openfiles">
<property name="label" translatable="yes">Show documents list</property>
Expand All @@ -1575,7 +1639,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
Expand Down
8 changes: 8 additions & 0 deletions src/callbacks.c
Expand Up @@ -1901,6 +1901,14 @@ static void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer us
}


static void on_show_symbol_list_toggled(GtkToggleButton *button, gpointer user_data)
{
GtkWidget *widget = ui_lookup_widget(ui_widgets.prefs_dialog, "box_show_symbol_list_children");

gtk_widget_set_sensitive(widget, gtk_toggle_button_get_active(button));
}


static void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data)
{
GeanyDocument *doc = document_get_current();
Expand Down
5 changes: 4 additions & 1 deletion src/document.c
Expand Up @@ -2811,7 +2811,10 @@ static void document_load_config(GeanyDocument *doc, GeanyFiletype *type,
editor_set_indentation_guides(doc->editor);
build_menu_update(doc);
queue_colourise(doc);
doc->priv->symbol_list_sort_mode = type->priv->symbol_list_sort_mode;
if (type->priv->symbol_list_sort_mode == SYMBOLS_SORT_USE_PREVIOUS)
doc->priv->symbol_list_sort_mode = interface_prefs.symbols_sort_mode;
else
doc->priv->symbol_list_sort_mode = type->priv->symbol_list_sort_mode;
}

document_update_tags(doc);
Expand Down
2 changes: 1 addition & 1 deletion src/filetypes.c
Expand Up @@ -965,7 +965,7 @@ static void load_settings(guint ft_id, GKeyFile *config, GKeyFile *configh)
}

ft->priv->symbol_list_sort_mode = utils_get_setting(integer, configh, config, "settings",
"symbol_list_sort_mode", SYMBOLS_SORT_BY_NAME);
"symbol_list_sort_mode", SYMBOLS_SORT_USE_PREVIOUS);
ft->priv->xml_indent_tags = utils_get_setting(boolean, configh, config, "settings",
"xml_indent_tags", FALSE);

Expand Down
6 changes: 6 additions & 0 deletions src/keyfile.c
Expand Up @@ -48,6 +48,7 @@
#include "sciwrappers.h"
#include "stash.h"
#include "support.h"
#include "symbols.h"
#include "templates.h"
#include "toolbar.h"
#include "ui_utils.h"
Expand Down Expand Up @@ -161,6 +162,11 @@ static void init_pref_groups(void)
"radio_sidebar_left", GTK_POS_LEFT,
"radio_sidebar_right", GTK_POS_RIGHT,
NULL);
stash_group_add_radio_buttons(group, &interface_prefs.symbols_sort_mode,
"symbols_sort_mode", SYMBOLS_SORT_BY_NAME,
"radio_symbols_sort_by_name", SYMBOLS_SORT_BY_NAME,
"radio_symbols_sort_by_appearance", SYMBOLS_SORT_BY_APPEARANCE,
NULL);
stash_group_add_radio_buttons(group, &interface_prefs.msgwin_orientation,
"msgwin_orientation", GTK_ORIENTATION_VERTICAL,
"radio_msgwin_vertical", GTK_ORIENTATION_VERTICAL,
Expand Down
3 changes: 1 addition & 2 deletions src/prefs.c
Expand Up @@ -1558,8 +1558,7 @@ static void on_sidebar_visible_toggled(GtkToggleButton *togglebutton, gpointer u
{
gboolean sens = gtk_toggle_button_get_active(togglebutton);

gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_openfiles"), sens);
gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "check_list_symbol"), sens);
gtk_widget_set_sensitive(ui_lookup_widget(ui_widgets.prefs_dialog, "box_sidebar_visible_children"), sens);
}


Expand Down
1 change: 1 addition & 0 deletions src/ui_utils.h
Expand Up @@ -68,6 +68,7 @@ typedef struct GeanyInterfacePrefs
/** whether compiler messages window is automatically scrolled to show new messages */
gboolean compiler_tab_autoscroll;
gint msgwin_orientation; /**< orientation of the message window */
gint symbols_sort_mode; /**< symbol list sorting mode */
}
GeanyInterfacePrefs;

Expand Down

0 comments on commit 6e0d4ac

Please sign in to comment.