[gnome-photos/wip/rishi/keyboard-activation: 4/4] embed, view-container: Consolidate keyboard and mouse activation
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/keyboard-activation: 4/4] embed, view-container: Consolidate keyboard and mouse activation
- Date: Tue, 28 Jun 2016 09:24:18 +0000 (UTC)
commit 56922ceaef13f6fdd3346f7d114e9f5f05f17b64
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jun 28 10:48:27 2016 +0200
embed, view-container: Consolidate keyboard and mouse activation
https://bugzilla.gnome.org/show_bug.cgi?id=768130
src/photos-embed.c | 15 +--------------
src/photos-view-container.c | 22 ++++++++++++++++++++++
src/photos-view-container.h | 2 ++
3 files changed, 25 insertions(+), 14 deletions(-)
---
diff --git a/src/photos-embed.c b/src/photos-embed.c
index f440832..5982666 100644
--- a/src/photos-embed.c
+++ b/src/photos-embed.c
@@ -176,25 +176,12 @@ photos_embed_get_view_container_from_mode (PhotosEmbed *self, PhotosWindowMode m
static void
photos_embed_activate_result (PhotosEmbed *self)
{
- GtkTreeIter iter;
- GtkListStore *store;
GtkWidget *view_container;
PhotosWindowMode mode;
mode = photos_mode_controller_get_window_mode (self->mode_cntrlr);
view_container = photos_embed_get_view_container_from_mode (self, mode);
- store = photos_view_container_get_model (PHOTOS_VIEW_CONTAINER (view_container));
-
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
- {
- GObject *item;
- gchar *id;
-
- gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, PHOTOS_VIEW_MODEL_URN, &id, -1);
- item = photos_base_manager_get_object_by_id (self->item_mngr, id);
- photos_base_manager_set_active_object (self->item_mngr, item);
- g_free (id);
- }
+ photos_view_container_activate_item (PHOTOS_VIEW_CONTAINER (view_container));
}
diff --git a/src/photos-view-container.c b/src/photos-view-container.c
index 238b126..4fa00a8 100644
--- a/src/photos-view-container.c
+++ b/src/photos-view-container.c
@@ -479,6 +479,28 @@ photos_view_container_new (PhotosWindowMode mode, const gchar *name)
}
+void
+photos_view_container_activate_item (PhotosViewContainer *self)
+{
+ GtkTreePath *path = NULL;
+ GtkWidget *generic_view;
+
+ generic_view = gd_main_view_get_generic_view (self->view);
+ if (!gtk_icon_view_get_cursor (GTK_ICON_VIEW (generic_view), &path, NULL))
+ {
+ GtkTreeIter iter;
+
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (self->model), &iter))
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (self->model), &iter);
+ }
+
+ if (path != NULL)
+ gtk_icon_view_item_activated (GTK_ICON_VIEW (generic_view), path);
+
+ g_clear_pointer (&path, (GDestroyNotify) gtk_tree_path_free);
+}
+
+
GtkTreePath *
photos_view_container_get_current_path (PhotosViewContainer *self)
{
diff --git a/src/photos-view-container.h b/src/photos-view-container.h
index fedab39..43ddbde 100644
--- a/src/photos-view-container.h
+++ b/src/photos-view-container.h
@@ -48,6 +48,8 @@ GType photos_view_container_get_type (void) G_GNU
GtkWidget *photos_view_container_new (PhotosWindowMode mode, const gchar
*name);
+void photos_view_container_activate_item (PhotosViewContainer *self);
+
GtkTreePath *photos_view_container_get_current_path (PhotosViewContainer *self);
GtkListStore *photos_view_container_get_model (PhotosViewContainer *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]