[gupnp-tools/wip/search: 11/12] av-cp: Add proper title to search dialog
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-tools/wip/search: 11/12] av-cp: Add proper title to search dialog
- Date: Thu, 18 Aug 2016 08:45:52 +0000 (UTC)
commit c183e54eac62441f8f64d5cb8cc2cc7d04faa614
Author: Jens Georg <mail jensge org>
Date: Thu Aug 18 10:29:31 2016 +0200
av-cp: Add proper title to search dialog
Signed-off-by: Jens Georg <mail jensge org>
src/av-cp/playlist-treeview.c | 3 +++
src/av-cp/search-dialog.c | 31 +++++++++++++++++++++++++++++++
src/av-cp/search-dialog.h | 3 +++
3 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/av-cp/playlist-treeview.c b/src/av-cp/playlist-treeview.c
index 76dc9fa..c40912f 100644
--- a/src/av-cp/playlist-treeview.c
+++ b/src/av-cp/playlist-treeview.c
@@ -319,6 +319,7 @@ on_search_menu_item_activated (GtkMenuItem *menuitem,
GtkTreeModel *model;
GtkTreeIter iter;
char *id = NULL;
+ char *title = NULL;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
g_assert (selection != NULL);
@@ -329,6 +330,7 @@ on_search_menu_item_activated (GtkMenuItem *menuitem,
gtk_tree_model_get (model,
&iter,
+ 1, &title,
2, &server,
4, &id,
-1);
@@ -339,6 +341,7 @@ on_search_menu_item_activated (GtkMenuItem *menuitem,
search_dialog_set_server (SEARCH_DIALOG (search_dialog), server);
search_dialog_set_container_id (SEARCH_DIALOG (search_dialog), id);
+ search_dialog_set_container_title (SEARCH_DIALOG (search_dialog), title);
gtk_dialog_run (search_dialog);
}
diff --git a/src/av-cp/search-dialog.c b/src/av-cp/search-dialog.c
index 51c2d5d..18a0b7b 100644
--- a/src/av-cp/search-dialog.c
+++ b/src/av-cp/search-dialog.c
@@ -18,6 +18,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+#include <glib/gi18n.h>
#include <libgupnp-av/gupnp-av.h>
#include <string.h>
@@ -38,6 +39,7 @@ struct _SearchDialogPrivate {
GtkListStore *search_dialog_liststore;
GtkEntry *search_dialog_entry;
char *id;
+ char *title;
AVCPMediaServer *server;
guint pulse_timer;
};
@@ -197,10 +199,39 @@ void
search_dialog_set_container_id (SearchDialog *self, char *id)
{
SearchDialogPrivate *priv = search_dialog_get_instance_private (self);
+ g_free (priv->id);
priv->id = id;
}
+void
+search_dialog_set_container_title (SearchDialog *self, char *title)
+{
+ char *name = NULL;
+ char *window_title = NULL;
+
+ SearchDialogPrivate *priv = search_dialog_get_instance_private (self);
+ g_free (priv->title);
+
+ priv->title = title;
+ name = gupnp_device_info_get_friendly_name
+ (GUPNP_DEVICE_INFO (priv->server));
+
+ if (g_str_equal (priv->id, "0")) {
+ window_title = g_strdup_printf (_("Searching on %s"),
+ name);
+ } else {
+ window_title = g_strdup_printf (_("Searching in %s on %s"),
+ title,
+ name);
+ }
+
+ gtk_window_set_title (GTK_WINDOW (self), window_title);
+
+ g_free (name);
+ g_free (window_title);
+}
+
static gboolean
pulse_timer (gpointer user_data)
{
diff --git a/src/av-cp/search-dialog.h b/src/av-cp/search-dialog.h
index ce009b1..0d9b60e 100644
--- a/src/av-cp/search-dialog.h
+++ b/src/av-cp/search-dialog.h
@@ -41,4 +41,7 @@ search_dialog_set_server (SearchDialog *self, AVCPMediaServer *server);
void
search_dialog_set_container_id (SearchDialog *self, char *id);
+void
+search_dialog_set_container_title (SearchDialog *self, char *title);
+
#endif /* SEARCH_DIALOG_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]