Skip to content

Commit

Permalink
Merge branch 'ricotz/vala' into 'master'
Browse files Browse the repository at this point in the history
Don't alter or try to write [GtkChild] fields

See merge request GNOME/dconf-editor!17
  • Loading branch information
ricotz committed Jan 17, 2021
2 parents 2473d93 + fdc9084 commit 9272e9f
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 75 deletions.
4 changes: 2 additions & 2 deletions editor/bookmarks-headerbar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
install_action_entries ();

add_bookmarks_revealer (out bookmarks_revealer,
out bookmarks_button, ref center_box);
out bookmarks_button, center_box);
connect_bookmarks_signals ();
add_bookmarks_controller (out bookmarks_controller, ref this);

Expand Down Expand Up @@ -58,7 +58,7 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
private Bookmarks bookmarks_button;
private BookmarksController bookmarks_controller;

private static void add_bookmarks_revealer (out Revealer bookmarks_revealer, out Bookmarks bookmarks_button, ref Box center_box)
private static void add_bookmarks_revealer (out Revealer bookmarks_revealer, out Bookmarks bookmarks_button, Box center_box)
{
bookmarks_revealer = new Revealer ();
bookmarks_revealer.transition_type = RevealerTransitionType.SLIDE_LEFT;
Expand Down
4 changes: 2 additions & 2 deletions editor/bookmarks-list.vala
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ private class BookmarksList : OverlayedList

internal bool create_bookmark_rows (Variant bookmarks_variant)
{
_create_bookmark_rows (bookmarks_variant, view_mode, ref main_list_store, ref main_list_box, ref bookmarks_hashtable);
_create_bookmark_rows (bookmarks_variant, view_mode, ref main_list_store, main_list_box, ref bookmarks_hashtable);
return n_items == 0;
}
private static void _create_bookmark_rows (Variant bookmarks_variant, bool view_mode, ref GLib.ListStore main_list_store, ref ListBox main_list_box, ref HashTable<string, Bookmark> bookmarks_hashtable)
private static void _create_bookmark_rows (Variant bookmarks_variant, bool view_mode, ref GLib.ListStore main_list_store, ListBox main_list_box, ref HashTable<string, Bookmark> bookmarks_hashtable)
{
string saved_bookmark_name = "";
ListBoxRow? selected_row = main_list_box.get_selected_row ();
Expand Down
12 changes: 6 additions & 6 deletions editor/bookmarks.vala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private class Bookmarks : MenuButton

construct
{
update_switch_label (ViewType.SEARCH, ViewType.FOLDER, ref switch_label); // init text with "Bookmark this Location"
update_switch_label (ViewType.SEARCH, ViewType.FOLDER, switch_label); // init text with "Bookmark this Location"

install_action_entries ();

Expand Down Expand Up @@ -184,7 +184,7 @@ private class Bookmarks : MenuButton

internal void set_path (ViewType type, string path)
{
update_switch_label (current_type, type, ref switch_label);
update_switch_label (current_type, type, switch_label);

current_path = path;
current_type = type;
Expand Down Expand Up @@ -392,7 +392,7 @@ private class Bookmarks : MenuButton
* * Bookmarks management
\*/

private static void update_switch_label (ViewType old_type, ViewType new_type, ref Label switch_label)
private static void update_switch_label (ViewType old_type, ViewType new_type, Label switch_label)
{
if (new_type == ViewType.SEARCH && old_type != ViewType.SEARCH)
switch_label.label = bookmark_this_search_text;
Expand All @@ -414,18 +414,18 @@ private class Bookmarks : MenuButton
{
if (bookmarks_icon.icon_name != "starred-symbolic")
bookmarks_icon.icon_name = "starred-symbolic";
update_switch_state (true, ref bookmarked_switch);
update_switch_state (true, bookmarked_switch);
bookmarked_switch.set_detailed_action_name ("bookmarks.unbookmark(" + variant.print (true) + ")");
}
else
{
if (bookmarks_icon.icon_name != "non-starred-symbolic")
bookmarks_icon.icon_name = "non-starred-symbolic";
update_switch_state (false, ref bookmarked_switch);
update_switch_state (false, bookmarked_switch);
bookmarked_switch.set_detailed_action_name ("bookmarks.bookmark(" + variant.print (true) + ")");
}
}
private static void update_switch_state (bool bookmarked, ref Switch bookmarked_switch)
private static void update_switch_state (bool bookmarked, Switch bookmarked_switch)
{
if (bookmarked == bookmarked_switch.active)
return;
Expand Down
54 changes: 27 additions & 27 deletions editor/delayed-setting-view.vala
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ private class DelayedSettingView : OverlayedListRow
{
// at row creation, key is never ghost
_update_dconf_key_current_value (key_value,
ref key_value_label,
ref key_value_default);
key_value_label,
key_value_default);

_update_dconf_key_planned_value (cool_planned_value,
ref planned_value_label,
ref planned_value_default);
planned_value_label,
planned_value_default);
}
else
{
_update_gsettings_key_current_value (key_value,
has_schema_and_is_default,
ref key_value_label,
ref key_value_default);
key_value_label,
key_value_default);

_update_gsettings_key_planned_value (cool_planned_value,
(!) cool_default_value,
ref planned_value_label,
ref planned_value_default);
planned_value_label,
planned_value_default);
}
}

Expand All @@ -74,23 +74,23 @@ private class DelayedSettingView : OverlayedListRow

private static inline void _update_gsettings_key_planned_value (string? cool_planned_value,
string cool_default_value,
ref Label planned_value_label,
ref Label planned_value_default)
Label planned_value_label,
Label planned_value_default)
{
bool is_default = cool_planned_value == null;
planned_value_label.label = is_default ? cool_default_value : (!) cool_planned_value;
update_value_default_label (is_default, ref planned_value_default);
update_value_default_label (is_default, planned_value_default);
}

private static inline void _update_dconf_key_planned_value (string? cool_planned_value,
ref Label planned_value_label,
ref Label planned_value_default)
Label planned_value_label,
Label planned_value_default)
{
if (cool_planned_value == null)
update_labels_dconf_key_erased (ref planned_value_label, ref planned_value_default);
update_labels_dconf_key_erased (planned_value_label, planned_value_default);
else
update_labels_dconf_key_values ((!) cool_planned_value,
ref planned_value_label, ref planned_value_default);
planned_value_label, planned_value_default);
}

/*\
Expand All @@ -99,52 +99,52 @@ private class DelayedSettingView : OverlayedListRow

internal void update_gsettings_key_current_value (Variant key_value, bool is_default)
{
_update_gsettings_key_current_value (key_value, is_default, ref key_value_label, ref key_value_default);
_update_gsettings_key_current_value (key_value, is_default, key_value_label, key_value_default);
}
private static void _update_gsettings_key_current_value (Variant key_value,
bool is_default,
ref Label key_value_label,
ref Label key_value_default)
Label key_value_label,
Label key_value_default)
{
key_value_label.label = Key.cool_text_value_from_variant (key_value);
update_value_default_label (is_default, ref key_value_default);
update_value_default_label (is_default, key_value_default);
}

internal void update_dconf_key_current_value (Variant? key_value_or_null)
{
_update_dconf_key_current_value (key_value_or_null, ref key_value_label, ref key_value_default);
_update_dconf_key_current_value (key_value_or_null, key_value_label, key_value_default);
}
private static void _update_dconf_key_current_value (Variant? key_value_or_null,
ref Label key_value_label,
ref Label key_value_default)
Label key_value_label,
Label key_value_default)
{
if (key_value_or_null == null)
update_labels_dconf_key_erased (ref key_value_label, ref key_value_default);
update_labels_dconf_key_erased (key_value_label, key_value_default);
else
update_labels_dconf_key_values (Key.cool_text_value_from_variant ((!) key_value_or_null),
ref key_value_label, ref key_value_default);
key_value_label, key_value_default);
}

/*\
* * common utilities
\*/

private static void update_labels_dconf_key_erased (ref Label value_label, ref Label value_default)
private static void update_labels_dconf_key_erased (Label value_label, Label value_default)
{
value_label.visible = false;
/* Translators: displayed in the list of pending changes (could be an in-window panel, or in the popover of the bottom bar); for dconf keys */
value_default.label = _("Key erased");
value_default.visible = true;
}

private static void update_labels_dconf_key_values (string key_value, ref Label value_label, ref Label value_default)
private static void update_labels_dconf_key_values (string key_value, Label value_label, Label value_default)
{
value_default.visible = false;
value_label.label = key_value; // TODO move Key.cool_text_value_from_variant here?
value_label.visible = true;
}

private static void update_value_default_label (bool is_default, ref Label value_default)
private static void update_value_default_label (bool is_default, Label value_default)
{
if (is_default)
/* Translators: displayed in the list of pending changes (could be an in-window panel, or in the popover of the bottom bar); for gsettings keys */
Expand Down
38 changes: 19 additions & 19 deletions editor/overlayed-list.vala
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
internal void set_window_size (AdaptativeWidget.WindowSize new_size)
{
if (!AdaptativeWidget.WindowSize.is_extra_thin (new_size) && AdaptativeWidget.WindowSize.is_extra_flat (new_size))
set_horizontal (ref main_context, ref edit_mode_box);
set_horizontal (ref main_context, edit_mode_box);
else
set_vertical (ref main_context, ref edit_mode_box);
set_vertical (ref main_context, edit_mode_box);
}
private static inline void set_horizontal (ref StyleContext main_context, ref Box edit_mode_box)
private static inline void set_horizontal (ref StyleContext main_context, Box edit_mode_box)
{
main_context.remove_class ("vertical");
edit_mode_box.halign = Align.END;
Expand All @@ -102,7 +102,7 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget
edit_mode_box.width_request = 160;
main_context.add_class ("horizontal");
}
private static inline void set_vertical (ref StyleContext main_context, ref Box edit_mode_box)
private static inline void set_vertical (ref StyleContext main_context, Box edit_mode_box)
{
main_context.remove_class ("horizontal");
edit_mode_box.halign = Align.CENTER;
Expand All @@ -118,9 +118,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget

internal bool next_match ()
{
return _next_match (ref main_list_box);
return _next_match (main_list_box);
}
private static inline bool _next_match (ref ListBox main_list_box)
private static inline bool _next_match (ListBox main_list_box)
{
ListBoxRow? row = main_list_box.get_selected_row (); // TODO multiple rows and focus-only lists
if (row == null)
Expand All @@ -130,7 +130,7 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget

if (row == null)
{
_scroll_bottom (ref main_list_box);
_scroll_bottom (main_list_box);
return false;
}
main_list_box.select_row ((!) row);
Expand All @@ -140,9 +140,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget

internal bool previous_match ()
{
return _previous_match (ref main_list_box);
return _previous_match (main_list_box);
}
private static inline bool _previous_match (ref ListBox main_list_box)
private static inline bool _previous_match (ListBox main_list_box)
{
uint n_items = main_list_box.get_children ().length (); // FIXME OverlayedList.n_items is unreliable
if (n_items == 0)
Expand Down Expand Up @@ -189,9 +189,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget

protected int [] get_selected_rows_indices ()
{
return _get_selected_rows_indices (ref main_list_box);
return _get_selected_rows_indices (main_list_box);
}
private static inline int [] _get_selected_rows_indices (ref ListBox main_list_box)
private static inline int [] _get_selected_rows_indices (ListBox main_list_box)
{
int [] indices = new int [0];
main_list_box.selected_foreach ((_list_box, selected_row) => {
Expand All @@ -205,29 +205,29 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget

protected void scroll_top ()
{
_scroll_top (ref main_list_box);
_scroll_top (main_list_box);
}
private static inline void _scroll_top (ref ListBox main_list_box)
private static inline void _scroll_top (ListBox main_list_box)
{
Adjustment adjustment = main_list_box.get_adjustment ();
adjustment.set_value (adjustment.get_lower ());
}

protected void scroll_bottom ()
{
_scroll_bottom (ref main_list_box);
_scroll_bottom (main_list_box);
}
private static inline void _scroll_bottom (ref ListBox main_list_box)
private static inline void _scroll_bottom (ListBox main_list_box)
{
Adjustment adjustment = main_list_box.get_adjustment ();
adjustment.set_value (adjustment.get_upper ());
}

internal bool handle_copy_text (out string copy_text)
{
return _handle_copy_text (out copy_text, ref main_list_box);
return _handle_copy_text (out copy_text, main_list_box);
}
private static inline bool _handle_copy_text (out string copy_text, ref ListBox main_list_box)
private static inline bool _handle_copy_text (out string copy_text, ListBox main_list_box)
{
List<weak ListBoxRow> selected_rows = main_list_box.get_selected_rows ();
OverlayedListRow row;
Expand Down Expand Up @@ -283,9 +283,9 @@ private abstract class OverlayedList : Overlay, AdaptativeWidget

internal SelectionState get_selection_state ()
{
return _get_selection_state (ref main_list_box, ref main_list_store);
return _get_selection_state (main_list_box, ref main_list_store);
}
private static inline SelectionState _get_selection_state (ref ListBox main_list_box, ref GLib.ListStore main_list_store)
private static inline SelectionState _get_selection_state (ListBox main_list_box, ref GLib.ListStore main_list_store)
{
List<weak ListBoxRow> selected_rows = main_list_box.get_selected_rows ();
uint n_selected_rows = selected_rows.length ();
Expand Down
Loading

0 comments on commit 9272e9f

Please sign in to comment.