Exemplo n.º 1
0
static void
xmr_search_box_init(XmrSearchBox *box)
{
	XmrSearchBoxPrivate *priv;
	GtkWidget *vbox;
	
	priv = box->priv = G_TYPE_INSTANCE_GET_PRIVATE(box, XMR_TYPE_SEARCH_BOX, XmrSearchBoxPrivate);
	priv->parent = NULL;
	priv->need_to_show = FALSE;
	priv->thread = NULL;
	priv->chooser = XMR_CHOOSER(xmr_chooser_new(_("Artist Radio"), GTK_ORIENTATION_VERTICAL));
	priv->event_queue = g_async_queue_new();
	priv->event_idle_id = 0;
	priv->progress_idle_id = 0;
	
	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 3);
	gtk_container_add(GTK_CONTAINER(box), vbox);
	
	priv->entry_box = gtk_entry_new();
	gtk_box_pack_start(GTK_BOX(vbox), priv->entry_box, TRUE, TRUE, 0);
	
	gtk_entry_set_icon_from_icon_name(GTK_ENTRY(priv->entry_box), GTK_ENTRY_ICON_SECONDARY, "edit-find");
	gtk_entry_set_placeholder_text(GTK_ENTRY(priv->entry_box), _("Enter artist name..."));
	
	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(box), TRUE);
	gtk_window_set_skip_pager_hint(GTK_WINDOW(box), TRUE);
	gtk_window_set_title(GTK_WINDOW(box), _("Search Artist Radio"));
	gtk_widget_set_size_request(GTK_WIDGET(box), 350, 45);
	
	gtk_window_set_decorated(GTK_WINDOW(priv->chooser),  FALSE);
	gtk_window_set_transient_for(GTK_WINDOW(priv->chooser), GTK_WINDOW(box));
	gtk_window_set_resizable(GTK_WINDOW(priv->chooser), FALSE);
	gtk_widget_set_size_request(GTK_WIDGET(priv->chooser), 350, 200);
	xmr_chooser_set_hide_on_clicked(priv->chooser, FALSE);
	
	g_signal_connect(box, "delete-event", G_CALLBACK(on_delete), NULL);
	g_signal_connect(box, "key-release-event", G_CALLBACK(on_key_release), NULL);
	
	g_signal_connect(priv->entry_box, "activate", G_CALLBACK(on_search_box_activate), box);
	
	g_signal_connect(priv->chooser, "widget-selected", G_CALLBACK(on_artist_clicked), box);
	
	gtk_window_set_position(GTK_WINDOW(box), GTK_WIN_POS_CENTER);
	gtk_widget_show_all(vbox);
}
Exemplo n.º 2
0
static void
xmr_chooser_get_property(GObject *object,
							 guint prop_id,
							 GValue *value,
							 GParamSpec *pspec)
{
	XmrChooser *chooser = XMR_CHOOSER(object);
	XmrChooserPrivate *priv = chooser->priv;

	switch(prop_id)
	{
	case PROP_ORIENTATION:
		g_value_set_enum(value, priv->orientation);
		break;

	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
		break;
	}
}
Exemplo n.º 3
0
static void
xmr_chooser_set_property(GObject *object,
							 guint prop_id,
							 const GValue *value,
							 GParamSpec *pspec)
{
	XmrChooser *chooser = XMR_CHOOSER(object);
	XmrChooserPrivate *priv = chooser->priv;

	switch(prop_id)
	{
	case PROP_ORIENTATION:
		priv->orientation = g_value_get_enum(value);
		priv->box = gtk_box_new(priv->orientation, 10);
		gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(priv->view), priv->box);
		break;

	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
		break;
	}
}