summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-06-26 08:39:49 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-06-26 08:39:49 +0200
commit29a7aef998e975b42401cfa96d1b750d91eadf06 (patch)
treeeda2bdff398789ea2358cc39986dd1f7ee9d027a /src
parent4e10e30c2f99d552239871aa1b27a08a6c18f1a4 (diff)
Imported Upstream version 0.23.2upstream/0.23.2
Diffstat (limited to 'src')
-rw-r--r--src/CheckerboardLayout.vala11
-rw-r--r--src/SearchFilter.vala39
-rw-r--r--src/camera/CameraTable.vala12
-rw-r--r--src/camera/GPhoto.vala66
-rw-r--r--src/library/LibraryWindow.vala33
5 files changed, 48 insertions, 113 deletions
diff --git a/src/CheckerboardLayout.vala b/src/CheckerboardLayout.vala
index 30f3d66..032235f 100644
--- a/src/CheckerboardLayout.vala
+++ b/src/CheckerboardLayout.vala
@@ -911,7 +911,11 @@ public class CheckerboardLayout : Gtk.DrawingArea {
debug("on_viewport_resized: due_to_reflow=%s set_size_request %dx%d",
size_allocate_due_to_reflow.to_string(), parent_allocation.width, req.height);
#endif
- set_size_request(parent_allocation.width - SCROLLBAR_PLACEHOLDER_WIDTH, req.height);
+ // But if the current height is 0, don't request a size yet. Delay
+ // it to do_reflow (bgo#766864)
+ if (req.height != 0) {
+ set_size_request(parent_allocation.width - SCROLLBAR_PLACEHOLDER_WIDTH, req.height);
+ }
} else {
// set the layout's width and height to always match the parent's
set_size_request(parent_allocation.width, parent_allocation.height);
@@ -1808,6 +1812,10 @@ public class CheckerboardLayout : Gtk.DrawingArea {
// we want switched_to() to be the final call in the process (indicating that the page is
// now in place and should do its thing to update itself), have to be be prepared for
// GTK/GDK calls between the widgets being actually present on the screen and "switched to"
+
+ Gtk.Allocation allocation;
+ get_allocation(out allocation);
+ get_style_context().render_background (ctx, 0, 0, allocation.width, allocation.height);
// watch for message mode
if (message == null) {
@@ -1829,7 +1837,6 @@ public class CheckerboardLayout : Gtk.DrawingArea {
int text_width, text_height;
pango_layout.get_pixel_size(out text_width, out text_height);
- Gtk.Allocation allocation;
get_allocation(out allocation);
int x = allocation.width - text_width;
diff --git a/src/SearchFilter.vala b/src/SearchFilter.vala
index fafdc09..23f7aed 100644
--- a/src/SearchFilter.vala
+++ b/src/SearchFilter.vala
@@ -701,13 +701,19 @@ public class SearchFilterToolbar : Gtk.Revealer {
public void set_icon_name(string icon_name) {
Gtk.Image? image = null;
+ button.set_always_show_image(true);
if (icon_name.contains("disabled"))
image = new Gtk.Image.from_stock(icon_name, Gtk.IconSize.SMALL_TOOLBAR);
else
image = new Gtk.Image.from_icon_name(icon_name, Gtk.IconSize.SMALL_TOOLBAR);
-
+ image.set_margin_end(6);
button.set_image(image);
}
+
+ public void set_label(string label) {
+ button.set_label(label);
+ }
+
}
// Ticket #3260 - Add a 'close' context menu to
@@ -857,8 +863,11 @@ public class SearchFilterToolbar : Gtk.Revealer {
break;
}
- return new Gtk.Image.from_pixbuf(Resources.load_icon(filename,
+ Gtk.Image image = new Gtk.Image.from_pixbuf(Resources.load_icon(filename,
get_filter_icon_size(filter)));
+ image.set_margin_end(6);
+
+ return image;
}
private int get_filter_icon_size(RatingFilter filter) {
@@ -890,6 +899,7 @@ public class SearchFilterToolbar : Gtk.Revealer {
}
public void set_filter_icon(RatingFilter filter) {
+ button.set_always_show_image(true);
button.set_image(get_filter_icon(filter));
set_size_request(get_filter_button_size(filter), -1);
set_tooltip_text(Resources.get_rating_filter_tooltip(filter));
@@ -900,6 +910,11 @@ public class SearchFilterToolbar : Gtk.Revealer {
private int get_filter_button_size(RatingFilter filter) {
return get_filter_icon_size(filter) + 2 * FILTER_BUTTON_MARGIN;
}
+
+ public void set_label(string label) {
+ button.set_label(label);
+ }
+
}
public Gtk.UIManager ui = new Gtk.UIManager();
@@ -909,8 +924,6 @@ public class SearchFilterToolbar : Gtk.Revealer {
private RatingFilterButton rating_button = new RatingFilterButton();
private SearchViewFilter? search_filter = null;
private LabelToolItem label_type;
- private LabelToolItem label_flagged;
- private LabelToolItem label_rating;
private ToggleActionToolButton toolbtn_photos;
private ToggleActionToolButton toolbtn_videos;
private ToggleActionToolButton toolbtn_raw;
@@ -968,11 +981,10 @@ public class SearchFilterToolbar : Gtk.Revealer {
sepr_mediatype_flagged = new Gtk.SeparatorToolItem();
toolbar.insert(sepr_mediatype_flagged, -1);
- // Flagged label and toggle
- label_flagged = new LabelToolItem(_("Flagged"));
- toolbar.insert(label_flagged, -1);
+ // Flagged button
toolbtn_flag = new ToggleActionToolButton(actions.flagged);
+ toolbtn_flag.set_label(_("Flagged"));
toolbtn_flag.set_tooltip_text(actions.get_action_group().get_action("CommonDisplayFlagged").tooltip);
toolbar.insert(toolbtn_flag, -1);
@@ -981,10 +993,9 @@ public class SearchFilterToolbar : Gtk.Revealer {
sepr_flagged_rating = new Gtk.SeparatorToolItem();
toolbar.insert(sepr_flagged_rating, -1);
- // Rating label and button
- label_rating = new LabelToolItem(_("Rating"));
- toolbar.insert(label_rating, -1);
+ // Rating button
rating_button.filter_popup = (Gtk.Menu) ui.get_widget("/FilterPopupMenu");
+ rating_button.set_label(_("Rating"));
rating_button.set_expand(false);
rating_button.clicked.connect(on_filter_button_clicked);
toolbar.insert(rating_button, -1);
@@ -1160,9 +1171,7 @@ public class SearchFilterToolbar : Gtk.Revealer {
search_box.visible = ((criteria & SearchFilterCriteria.TEXT) != 0);
rating_button.visible = ((criteria & SearchFilterCriteria.RATING) != 0);
- label_rating.visible = ((criteria & SearchFilterCriteria.RATING) != 0);
- label_flagged.visible = ((criteria & SearchFilterCriteria.FLAG) != 0);
toolbtn_flag.visible = ((criteria & SearchFilterCriteria.FLAG) != 0);
label_type.visible = ((criteria & SearchFilterCriteria.MEDIA) != 0);
@@ -1172,10 +1181,10 @@ public class SearchFilterToolbar : Gtk.Revealer {
// Ticket #3290, part IV - ensure that the separators
// are shown and/or hidden as needed.
- sepr_mediatype_flagged.visible = (label_type.visible && label_flagged.visible);
+ sepr_mediatype_flagged.visible = (label_type.visible && toolbtn_flag.visible);
- sepr_flagged_rating.visible = ((label_type.visible && label_rating.visible) ||
- (label_flagged.visible && label_rating.visible));
+ sepr_flagged_rating.visible = ((label_type.visible && rating_button.visible) ||
+ (toolbtn_flag.visible && rating_button.visible));
// Send update to view collection.
search_filter.refresh();
diff --git a/src/camera/CameraTable.vala b/src/camera/CameraTable.vala
index f59dcff..7eb7ae2 100644
--- a/src/camera/CameraTable.vala
+++ b/src/camera/CameraTable.vala
@@ -276,11 +276,7 @@ public class CameraTable {
do_op(camera.gcamera.get_port_info(out port_info),
"retrieve missing camera port information");
-#if WITH_GPHOTO_25
port_info.get_path(out tmp_path);
-#else
- tmp_path = port_info.path;
-#endif
GPhoto.CameraAbilities abilities;
do_op(camera.gcamera.get_abilities(out abilities), "retrieve camera abilities");
@@ -303,11 +299,7 @@ public class CameraTable {
do_op(camera.gcamera.get_port_info(out port_info),
"retrieve missing camera port information");
-#if WITH_GPHOTO_25
port_info.get_path(out tmp_path);
-#else
- tmp_path = port_info.path;
-#endif
GPhoto.CameraAbilities abilities;
do_op(camera.gcamera.get_abilities(out abilities), "retrieve missing camera abilities");
@@ -363,11 +355,7 @@ public class CameraTable {
string tmp_path;
do_op(port_info_list.get_info(index, out port_info), "get port info for %s".printf(port));
-#if WITH_GPHOTO_25
port_info.get_path(out tmp_path);
-#else
- tmp_path = port_info.path;
-#endif
// this should match, every time
assert(port == tmp_path);
diff --git a/src/camera/GPhoto.vala b/src/camera/GPhoto.vala
index ac911dd..b16e32b 100644
--- a/src/camera/GPhoto.vala
+++ b/src/camera/GPhoto.vala
@@ -25,8 +25,6 @@ namespace GPhoto {
public virtual void idle() {
}
-#if WITH_GPHOTO_25
-
public virtual void error(string text, void *data) {
}
@@ -75,57 +73,6 @@ namespace GPhoto {
progress_stop();
}
-#else
-
- public virtual void error(string format, void *va_list) {
- }
-
- public virtual void status(string format, void *va_list) {
- }
-
- public virtual void message(string format, void *va_list) {
- }
-
- public virtual void progress_start(float target, string format, void *va_list) {
- }
-
- public virtual void progress_update(float current) {
- }
-
- public virtual void progress_stop() {
- }
-
- private void on_idle(Context context) {
- idle();
- }
-
- private void on_error(Context context, string format, void *va_list) {
- error(format, va_list);
- }
-
- private void on_status(Context context, string format, void *va_list) {
- status(format, va_list);
- }
-
- private void on_message(Context context, string format, void *va_list) {
- message(format, va_list);
- }
-
- private uint on_progress_start(Context context, float target, string format, void *va_list) {
- progress_start(target, format, va_list);
-
- return 0;
- }
-
- private void on_progress_update(Context context, uint id, float current) {
- progress_update(current);
- }
-
- private void on_progress_stop(Context context, uint id) {
- progress_stop();
- }
-
-#endif
}
public class SpinIdleWrapper : ContextWrapper {
@@ -137,19 +84,12 @@ namespace GPhoto {
spin_event_loop();
}
-#if WITH_GPHOTO_25
+
public override void progress_update(float current, void *data) {
base.progress_update(current, data);
spin_event_loop();
}
-#else
- public override void progress_update(float current) {
- base.progress_update(current);
-
- spin_event_loop();
- }
-#endif
}
// For CameraFileInfoFile, CameraFileInfoPreview, and CameraStorageInformation. See:
@@ -187,11 +127,7 @@ namespace GPhoto {
camera.get_port_info(out port_info);
string path;
-#if WITH_GPHOTO_25
port_info.get_path(out path);
-#else
- path = port_info.path;
-#endif
string prefix = "disk:";
if(path.has_prefix(prefix))
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index 5779ef4..21fc85e 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -136,7 +136,7 @@ public class LibraryWindow : AppWindow {
private BasicProperties basic_properties = new BasicProperties();
private ExtendedPropertiesWindow extended_properties;
- private Gtk.Notebook notebook = new Gtk.Notebook();
+ private Gtk.Stack stack = new Gtk.Stack();
private Gtk.Box layout = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
private Gtk.Box right_vbox;
@@ -1037,7 +1037,7 @@ public class LibraryWindow : AppWindow {
assert(controller.get_view().get_view_for_source(current) != null);
if (photo_page == null) {
photo_page = new LibraryPhotoPage();
- add_to_notebook(photo_page);
+ add_to_stack(photo_page);
// need to do this to allow the event loop a chance to map and realize the page
// before switching to it
@@ -1080,22 +1080,20 @@ public class LibraryWindow : AppWindow {
}
// This should only be called by LibraryWindow and PageStub.
- public void add_to_notebook(Page page) {
- // need to show all before handing over to notebook
+ public void add_to_stack(Page page) {
+ // need to show all before handing over to stack
page.show_all();
- int pos = notebook.append_page(page, null);
- assert(pos >= 0);
-
+ stack.add(page);
// need to show_all() after pages are added and removed
- notebook.show_all();
+ stack.show_all();
}
- private void remove_from_notebook(Page page) {
- notebook.remove(page);
+ private void remove_from_stack(Page page) {
+ stack.remove(page);
// need to show_all() after pages are added and removed
- notebook.show_all();
+ stack.show_all();
}
// check for settings that should persist between instances
@@ -1260,9 +1258,6 @@ public class LibraryWindow : AppWindow {
}
private void create_layout(Page start_page) {
- // use a Notebook to hold all the pages, which are switched when a sidebar child is selected
- notebook.set_show_tabs(false);
- notebook.set_show_border(false);
// put the sidebar in a scrolling window
Gtk.ScrolledWindow scrolled_sidebar = new Gtk.ScrolledWindow(null, null);
@@ -1292,7 +1287,7 @@ public class LibraryWindow : AppWindow {
right_vbox = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
right_vbox.pack_start(search_toolbar, false, false, 0);
- right_vbox.pack_start(notebook, true, true, 0);
+ right_vbox.pack_start(stack, true, true, 0);
client_paned = new Gtk.Paned(Gtk.Orientation.HORIZONTAL);
client_paned.pack1(sidebar_paned, false, false);
@@ -1300,7 +1295,7 @@ public class LibraryWindow : AppWindow {
client_paned.pack2(right_vbox, true, false);
client_paned.set_position(Config.Facade.get_instance().get_sidebar_position());
// TODO: Calc according to layout's size, to give sidebar a maximum width
- notebook.set_size_request(PAGE_MIN_WIDTH, -1);
+ stack.set_size_request(PAGE_MIN_WIDTH, -1);
layout.pack_end(client_paned, true, true, 0);
@@ -1343,7 +1338,7 @@ public class LibraryWindow : AppWindow {
unsubscribe_from_basic_information(current_page);
}
- notebook.set_current_page(notebook.page_num(page));
+ stack.set_visible_child(page);
// do this prior to changing selection, as the change will fire a cursor-changed event,
// which will then call this function again
@@ -1418,7 +1413,7 @@ public class LibraryWindow : AppWindow {
assert(!page_map.has_key(page));
page_map.set(page, entry);
- add_to_notebook(page);
+ add_to_stack(page);
}
private void on_destroying_page(Sidebar.PageRepresentative entry, Page page) {
@@ -1426,7 +1421,7 @@ public class LibraryWindow : AppWindow {
if (page == get_current_page())
switch_to_page(library_branch.photos_entry.get_page());
- remove_from_notebook(page);
+ remove_from_stack(page);
bool removed = page_map.unset(page);
assert(removed);