Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new flat view mode and title filter #1249

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions glade/liferea_menu.ui
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,19 @@
</section>
<section>
<item>
<attribute name="action">app.reduced-feed-list</attribute>
<attribute name="label" translatable="yes">_Reduced Feed List</attribute>
<attribute name="action">app.feedlist-view-mode</attribute>
<attribute name="label" translatable="yes">N_ormal feed list</attribute>
<attribute name="target">normal</attribute>
</item>
<item>
<attribute name="action">app.feedlist-view-mode</attribute>
<attribute name="label" translatable="yes">_Reduced feed list</attribute>
<attribute name="target">reduced</attribute>
</item>
<item>
<attribute name="action">app.feedlist-view-mode</attribute>
<attribute name="label" translatable="yes">F_lat feed list</attribute>
<attribute name="target">flat</attribute>
</item>
</section>
</submenu>
Expand Down
49 changes: 38 additions & 11 deletions glade/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,50 @@
<property name="vexpand">True</property>
<property name="position">170</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchEntry" id="titleFilter">
<property name="visible">False</property>
<property name="can-focus">True</property>
<property name="primary-icon-name">edit-find-symbolic</property>
<property name="primary-icon-activatable">False</property>
<property name="primary-icon-sensitive">False</property>
<property name="placeholder-text" translatable="yes">Filter (Alt+g)</property>
<accelerator key="g" signal="grab-focus" modifiers="GDK_MOD1_MASK"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="feedlist">
<object class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="headers-visible">False</property>
<property name="reorderable">True</property>
<signal name="button-press-event" handler="on_mainfeedlist_button_press_event" swapped="no"/>
<signal name="popup-menu" handler="on_mainfeedlist_popup_menu" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
<property name="hscrollbar-policy">never</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="feedlist">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="headers-visible">False</property>
<property name="reorderable">True</property>
<signal name="button-press-event" handler="on_mainfeedlist_button_press_event" swapped="no"/>
<signal name="popup-menu" handler="on_mainfeedlist_popup_menu" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection"/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
Expand Down
10 changes: 10 additions & 0 deletions net.sf.liferea.gschema.xml.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0"?>
<schemalist gettext-domain="liferea">
<enum id="net.sf.liferea.FeedlistViewMode">
<value value="0" nick="normal"/>
<value value="1" nick="reduced"/>
<value value="2" nick="flat"/>
</enum>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="net.sf.liferea" path="/org/gnome/liferea/">
<child name="plugins" schema="net.sf.liferea.plugins"/>
<key name="browse-inside-application" type="b">
Expand Down Expand Up @@ -132,6 +137,11 @@
<summary>Filter feeds without unread items from feed list.</summary>
<description>If this option is enabled the feed list will contain only feeds that have unread items.</description>
</key>
<key name="feedlist-view-mode" enum="net.sf.liferea.FeedlistViewMode">
<default>'normal'</default>
<summary>How the feed list is presented</summary>
<description>How the feed list is presented to the user. Possible values are "normal", "reduced", and "flat".</description>
</key>
<key name="download-custom-command" type="s">
<default>''</default>
<summary>Custom download command.</summary>
Expand Down
20 changes: 20 additions & 0 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,13 @@ conf_set_int_value (const gchar *key, gint value)
g_settings_set_int (settings, key, value);
}

void
conf_set_enum_value (const gchar *key, gint value)
{
g_assert (key != NULL);
g_settings_set_enum (settings, key, value);
}

gchar *
conf_get_toolbar_style(void)
{
Expand Down Expand Up @@ -295,6 +302,19 @@ conf_get_int_value_from_schema (GSettings *gsettings, const gchar *key, gint *va
return (NULL != value);
}

gboolean
conf_get_enum_value_from_schema (GSettings *gsettings, const gchar *key, gint *value)
{
g_assert (key != NULL);
g_assert (value != NULL);

if (gsettings == NULL)
gsettings = settings;
*value = g_settings_get_enum (gsettings,key);
return (NULL != value);
}


gboolean
conf_get_default_font (gchar **value)
{
Expand Down
23 changes: 22 additions & 1 deletion src/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/* folder handling settings */
#define FOLDER_DISPLAY_MODE "folder-display-mode"
#define FOLDER_DISPLAY_HIDE_READ "folder-display-hide-read"
#define REDUCED_FEEDLIST "reduced-feedlist"
#define FEEDLIST_VIEW_MODE "feedlist-view-mode"

/* GUI settings and persistency values */
#define CONFIRM_MARK_ALL_READ "confirm-mark-all-read"
Expand Down Expand Up @@ -95,6 +95,7 @@ void conf_deinit (void);
#define conf_get_str_value(key, value) conf_get_str_value_from_schema (NULL, key, value)
#define conf_get_strv_value(key, value) conf_get_strv_value_from_schema (NULL, key, value)
#define conf_get_int_value(key, value) conf_get_int_value_from_schema (NULL, key, value)
#define conf_get_enum_value(key, value) conf_get_enum_value_from_schema (NULL, key, value)


/**
Expand Down Expand Up @@ -153,6 +154,17 @@ gboolean conf_get_strv_value_from_schema (GSettings *gsettings,const gchar *key,
*/
gboolean conf_get_int_value_from_schema (GSettings *gsettings, const gchar *key, gint *value);

/**
* Retrieves the value of the given enum configuration key.
*
* @param gsettings gsettings schema to use
* @param key the configuration key
* @param value the value, if the function returned FALSE it's always 0
*
* @returns TRUE if the configuration key was found
*/
gboolean conf_get_enum_value_from_schema (GSettings *gsettings, const gchar *key, gint *value);

/**
* Sets the value of the given boolean configuration key.
*
Expand Down Expand Up @@ -187,6 +199,15 @@ void conf_set_strv_value (const gchar *key, const gchar **value);
*/
void conf_set_int_value (const gchar *key, gint value);

/**
* Sets the value of the given enum configuration key
*
* @param key the configuration key
* @param value the new enum (as integer) value
*/
void conf_set_enum_value (const gchar *key, gint value);


/**
* Returns the current toolbar configuration.
*
Expand Down
Loading
Loading