Пример #1
0
GtkWidget *
gimp_buffer_view_new (GimpViewType     view_type,
                      GimpContainer   *container,
                      GimpContext     *context,
                      gint             view_size,
                      gint             view_border_width,
                      GimpMenuFactory *menu_factory)
{
  GimpBufferView      *buffer_view;
  GimpContainerEditor *editor;
  GtkWidget           *frame;
  GtkWidget           *hbox;

  buffer_view = g_object_new (GIMP_TYPE_BUFFER_VIEW, NULL);

  if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (buffer_view),
                                         view_type,
                                         container, context,
                                         view_size, view_border_width,
                                         menu_factory, "<Buffers>",
                                         "/buffers-popup"))
    {
      g_object_unref (buffer_view);
      return NULL;
    }

  editor = GIMP_CONTAINER_EDITOR (buffer_view);

  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
  gtk_box_pack_start (GTK_BOX (editor), frame, FALSE, FALSE, 0);
  gtk_box_reorder_child (GTK_BOX (editor), frame, 0);
  gtk_widget_show (frame);

  hbox = gtk_hbox_new (FALSE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
  gtk_container_add (GTK_CONTAINER (frame), hbox);
  gtk_widget_show (hbox);

  buffer_view->global_view =
    gimp_view_new_full_by_types (NULL,
                                 GIMP_TYPE_VIEW,
                                 GIMP_TYPE_BUFFER,
                                 view_size, view_size, view_border_width,
                                 FALSE, FALSE, TRUE);
  gtk_box_pack_start (GTK_BOX (hbox), buffer_view->global_view,
                      FALSE, FALSE, 0);
  gtk_widget_show (buffer_view->global_view);

  g_signal_connect_object (editor->view, "notify::view-size",
                           G_CALLBACK (gimp_buffer_view_view_notify),
                           buffer_view, 0);
  g_signal_connect_object (editor->view, "notify::view-border-width",
                           G_CALLBACK (gimp_buffer_view_view_notify),
                           buffer_view, 0);

  buffer_view->global_label = gtk_label_new (_("(None)"));
  gtk_box_pack_start (GTK_BOX (hbox), buffer_view->global_label,
                      FALSE, FALSE, 0);
  gtk_widget_show (buffer_view->global_label);

  g_signal_connect_object (context->gimp, "buffer-changed",
                           G_CALLBACK (gimp_buffer_view_buffer_changed),
                           G_OBJECT (buffer_view), 0);

  gimp_buffer_view_buffer_changed (context->gimp, buffer_view);

  buffer_view->paste_button =
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
                                   "buffers-paste", NULL);

  buffer_view->paste_into_button =
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
                                   "buffers-paste-into", NULL);

  buffer_view->paste_as_new_button =
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
                                   "buffers-paste-as-new", NULL);

  buffer_view->delete_button =
    gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "buffers",
                                   "buffers-delete", NULL);

  gimp_container_view_enable_dnd (editor->view,
                                  GTK_BUTTON (buffer_view->paste_button),
                                  GIMP_TYPE_BUFFER);
  gimp_container_view_enable_dnd (editor->view,
                                  GTK_BUTTON (buffer_view->paste_into_button),
                                  GIMP_TYPE_BUFFER);
  gimp_container_view_enable_dnd (editor->view,
                                  GTK_BUTTON (buffer_view->paste_as_new_button),
                                  GIMP_TYPE_BUFFER);
  gimp_container_view_enable_dnd (editor->view,
                                  GTK_BUTTON (buffer_view->delete_button),
                                  GIMP_TYPE_BUFFER);

  gimp_ui_manager_update (gimp_editor_get_ui_manager (GIMP_EDITOR (editor->view)),
                          editor);

  return GTK_WIDGET (buffer_view);
}
Пример #2
0
static void
fs_rtp_sub_stream_constructed (GObject *object)
{
  FsRtpSubStream *self = FS_RTP_SUB_STREAM (object);
  GstPad *valve_sink_pad = NULL;
  GstPadLinkReturn linkret;
  gchar *tmp;

  GST_DEBUG ("New substream in session %u for ssrc %x and pt %u",
      self->priv->session->id, self->ssrc, self->pt);

  if (!self->priv->conference) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_INVALID_ARGUMENTS, "A Substream needs a conference object");
    return;
  }

  self->priv->rtpbin_unlinked_sig = g_signal_connect_object (
      self->priv->rtpbin_pad, "unlinked", G_CALLBACK (rtpbin_pad_unlinked),
      self, 0);

  tmp = g_strdup_printf ("output_recv_valve_%d_%d_%d", self->priv->session->id,
      self->ssrc, self->pt);
  self->priv->output_valve = gst_element_factory_make ("valve", tmp);
  g_free (tmp);

  if (!self->priv->output_valve) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not create a valve element for"
      " session substream with ssrc: %u and pt:%d", self->ssrc,
      self->pt);
    return;
  }

  if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->output_valve))
  {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not add the valve element for session"
      " substream with ssrc: %u and pt:%d to the conference bin",
      self->ssrc, self->pt);
    return;
  }

  /* We set the valve to dropping, the stream will unblock it when its linked */
  g_object_set (self->priv->output_valve, "drop", TRUE, NULL);

  if (gst_element_set_state (self->priv->output_valve, GST_STATE_PLAYING) ==
    GST_STATE_CHANGE_FAILURE) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not set the valve element for session"
      " substream with ssrc: %u and pt:%d to the playing state",
      self->ssrc, self->pt);
    return;
  }

  tmp = g_strdup_printf ("recv_capsfilter_%d_%d_%d", self->priv->session->id,
      self->ssrc, self->pt);
  self->priv->capsfilter = gst_element_factory_make ("capsfilter", tmp);
  g_free (tmp);

  if (!self->priv->capsfilter) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not create a capsfilter element for"
      " session substream with ssrc: %u and pt:%d", self->ssrc,
      self->pt);
    return;
  }

  if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->capsfilter)) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not add the capsfilter element for session"
      " substream with ssrc: %u and pt:%d to the conference bin",
      self->ssrc, self->pt);
    return;
  }

  if (gst_element_set_state (self->priv->capsfilter, GST_STATE_PLAYING) ==
    GST_STATE_CHANGE_FAILURE) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not set the capsfilter element for session"
      " substream with ssrc: %u and pt:%d to the playing state",
      self->ssrc, self->pt);
    return;
  }

  tmp = g_strdup_printf ("input_recv_valve_%d_%d_%d", self->priv->session->id,
      self->ssrc, self->pt);
  self->priv->input_valve = gst_element_factory_make ("valve", tmp);
  g_free (tmp);

  if (!self->priv->input_valve) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not create a valve element for"
      " session substream with ssrc: %u and pt:%d", self->ssrc,
      self->pt);
    return;
  }

  if (!gst_bin_add (GST_BIN (self->priv->conference), self->priv->input_valve))
  {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not add the valve element for session"
      " substream with ssrc: %u and pt:%d to the conference bin",
      self->ssrc, self->pt);
    return;
  }

  if (gst_element_set_state (self->priv->input_valve, GST_STATE_PLAYING) ==
    GST_STATE_CHANGE_FAILURE) {
    self->priv->construction_error = g_error_new (FS_ERROR,
      FS_ERROR_CONSTRUCTION, "Could not set the valve element for session"
      " substream with ssrc: %u and pt:%d to the playing state",
      self->ssrc, self->pt);
    return;
  }

  if (!gst_element_link (self->priv->input_valve, self->priv->capsfilter))
  {
    self->priv->construction_error = g_error_new (FS_ERROR,
        FS_ERROR_CONSTRUCTION, "Could not link the input valve"
        " and the capsfilter");
    return;
  }

  valve_sink_pad = gst_element_get_static_pad (self->priv->input_valve,
      "sink");
  if (!valve_sink_pad)
  {
    self->priv->construction_error = g_error_new (FS_ERROR,
        FS_ERROR_CONSTRUCTION,
        "Could not get the valve's sink pad");
    return;
  }

  linkret = gst_pad_link (self->priv->rtpbin_pad, valve_sink_pad);

  gst_object_unref (valve_sink_pad);

  if (GST_PAD_LINK_FAILED (linkret))
  {
    self->priv->construction_error = g_error_new (FS_ERROR,
        FS_ERROR_CONSTRUCTION,
        "Could not link the rtpbin to the codec bin (%d)", linkret);
    return;
  }

  if (self->no_rtcp_timeout > 0)
    if (!fs_rtp_sub_stream_start_no_rtcp_timeout_thread (self,
            &self->priv->construction_error))
      return;

  GST_CALL_PARENT (G_OBJECT_CLASS, constructed, (object));
}
Пример #3
0
static void
impl_constructed (GObject *object)
{
	RBPodcastAddDialog *dialog;
	GtkBuilder *builder;
	GtkWidget *widget;
	GtkWidget *paned;
	GtkTreeViewColumn *column;
	GtkCellRenderer *renderer;
	RBEntryView *episodes;
	RBShellPlayer *shell_player;
	RhythmDBQuery *query;
	RhythmDBQueryModel *query_model;
	const char *episode_strings[3];

	RB_CHAIN_GOBJECT_METHOD (rb_podcast_add_dialog_parent_class, constructed, object);
	dialog = RB_PODCAST_ADD_DIALOG (object);

	g_object_get (dialog->priv->podcast_mgr, "db", &dialog->priv->db, NULL);

	builder = rb_builder_load ("podcast-add-dialog.ui", NULL);

	dialog->priv->info_bar_message = gtk_label_new ("");
	dialog->priv->info_bar = gtk_info_bar_new ();
	g_object_set (dialog->priv->info_bar, "spacing", 0, NULL);
	gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (dialog->priv->info_bar))),
			   dialog->priv->info_bar_message);
	gtk_widget_set_no_show_all (dialog->priv->info_bar, TRUE);
	gtk_box_pack_start (GTK_BOX (dialog), dialog->priv->info_bar, FALSE, FALSE, 0);
	gtk_widget_show (dialog->priv->info_bar_message);

	dialog->priv->subscribe_button = GTK_WIDGET (gtk_builder_get_object (builder, "subscribe-button"));
	g_signal_connect_object (dialog->priv->subscribe_button, "clicked", G_CALLBACK (subscribe_clicked_cb), dialog, 0);
	gtk_widget_set_sensitive (dialog->priv->subscribe_button, FALSE);

	dialog->priv->feed_view = GTK_WIDGET (gtk_builder_get_object (builder, "feed-view"));
	g_signal_connect (dialog->priv->feed_view, "row-activated", G_CALLBACK (feed_activated_cb), dialog);
	g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->feed_view)),
			  "changed",
			  G_CALLBACK (feed_selection_changed_cb),
			  dialog);


	dialog->priv->search_entry = rb_search_entry_new (FALSE);
	gtk_widget_set_size_request (GTK_WIDGET (dialog->priv->search_entry), 400, -1);
	g_object_set (dialog->priv->search_entry,"explicit-mode", TRUE, NULL);
	g_signal_connect (dialog->priv->search_entry, "search", G_CALLBACK (search_cb), dialog);
	g_signal_connect (dialog->priv->search_entry, "activate", G_CALLBACK (search_cb), dialog);
	gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (builder, "search-entry-box")),
			   GTK_WIDGET (dialog->priv->search_entry));

	g_signal_connect (gtk_builder_get_object (builder, "close-button"),
			  "clicked",
			  G_CALLBACK (close_clicked_cb),
			  dialog);

	dialog->priv->feed_model = gtk_list_store_new (7,
						       G_TYPE_STRING,	/* name */
						       G_TYPE_STRING,	/* author */
						       GDK_TYPE_PIXBUF, /* image */
						       G_TYPE_FILE,	/* image file */
						       G_TYPE_INT,	/* episode count */
						       G_TYPE_POINTER,	/* RBPodcastChannel */
						       G_TYPE_ULONG);	/* date */
	gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->priv->feed_view), GTK_TREE_MODEL (dialog->priv->feed_model));

	column = gtk_tree_view_column_new_with_attributes (_("Title"), gtk_cell_renderer_pixbuf_new (), "pixbuf", FEED_COLUMN_IMAGE, NULL);
	renderer = gtk_cell_renderer_text_new ();
	g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	gtk_tree_view_column_pack_start (column, renderer, TRUE);
	gtk_tree_view_column_set_attributes (column, renderer, "text", FEED_COLUMN_TITLE, NULL);

	gtk_tree_view_column_set_expand (column, TRUE);
	gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->priv->feed_view), column);

	renderer = gtk_cell_renderer_text_new ();
	g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
	column = gtk_tree_view_column_new_with_attributes (_("Author"), renderer, "text", FEED_COLUMN_AUTHOR, NULL);
	gtk_tree_view_column_set_expand (column, TRUE);
	gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->priv->feed_view), column);

	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes (_("Episodes"), renderer, NULL);
	gtk_tree_view_column_set_cell_data_func (column, renderer, episode_count_column_cell_data_func, NULL, NULL);
	episode_strings[0] = "0000";
	episode_strings[1] = _("Episodes");
	episode_strings[2] = NULL;
	rb_set_tree_view_column_fixed_width (dialog->priv->feed_view, column, renderer, episode_strings, 6);
	gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->priv->feed_view), column);

	widget = GTK_WIDGET (gtk_builder_get_object (builder, "podcast-add-dialog"));
	gtk_box_pack_start (GTK_BOX (dialog), widget, TRUE, TRUE, 0);

	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (dialog->priv->feed_view), TRUE);

	/* set up episode view */
	g_object_get (dialog->priv->shell, "shell-player", &shell_player, NULL);
	episodes = rb_entry_view_new (dialog->priv->db, G_OBJECT (shell_player), TRUE, FALSE);
	g_object_unref (shell_player);

	g_signal_connect (episodes, "entry-activated", G_CALLBACK (episode_entry_activated_cb), dialog);

	/* date column */
	column = gtk_tree_view_column_new ();
	renderer = gtk_cell_renderer_text_new();

	gtk_tree_view_column_pack_start (column, renderer, TRUE);

	gtk_tree_view_column_set_clickable (column, TRUE);
	gtk_tree_view_column_set_resizable (column, TRUE);
	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
	{
		const char *sample_strings[3];
		sample_strings[0] = _("Date");
		sample_strings[1] = rb_entry_view_get_time_date_column_sample ();
		sample_strings[2] = NULL;
		rb_entry_view_set_fixed_column_width (episodes, column, renderer, sample_strings);
	}

	gtk_tree_view_column_set_cell_data_func (column, renderer,
						 (GtkTreeCellDataFunc) podcast_post_date_cell_data_func,
						 dialog, NULL);

	rb_entry_view_append_column_custom (episodes, column,
					    _("Date"), "Date",
					    (GCompareDataFunc) podcast_post_date_sort_func,
					    0, NULL);
	rb_entry_view_append_column (episodes, RB_ENTRY_VIEW_COL_TITLE, TRUE);
	rb_entry_view_append_column (episodes, RB_ENTRY_VIEW_COL_DURATION, TRUE);
	rb_entry_view_set_sorting_order (RB_ENTRY_VIEW (episodes), "Date", GTK_SORT_DESCENDING);
	g_signal_connect (episodes,
			  "notify::sort-order",
			  G_CALLBACK (episodes_sort_changed_cb),
			  dialog);

	query = rhythmdb_query_parse (dialog->priv->db,
				      RHYTHMDB_QUERY_PROP_EQUALS,
				      RHYTHMDB_PROP_TYPE,
				      RHYTHMDB_ENTRY_TYPE_PODCAST_SEARCH,
				      RHYTHMDB_QUERY_END);
	query_model = rhythmdb_query_model_new_empty (dialog->priv->db);
	rb_entry_view_set_model (episodes, query_model);

	rhythmdb_do_full_query_async_parsed (dialog->priv->db, RHYTHMDB_QUERY_RESULTS (query_model), query);
	rhythmdb_query_free (query);

	g_object_unref (query_model);

	paned = GTK_WIDGET (gtk_builder_get_object (builder, "paned"));
	g_signal_connect (paned, "size-allocate", G_CALLBACK (paned_size_allocate_cb), dialog);
	gtk_paned_pack2 (GTK_PANED (paned),
			 GTK_WIDGET (episodes),
			 TRUE,
			 FALSE);

	gtk_widget_show_all (GTK_WIDGET (dialog));
	g_object_unref (builder);
}
static void
tpaw_user_info_constructed (GObject *object)
{
  TpawUserInfo *self = (TpawUserInfo *) object;
  GtkGrid *grid = (GtkGrid *) self;
  GtkWidget *infobar;
  GtkWidget *infobar_content;
  GtkWidget *infobar_label;
  GtkWidget *title;

  G_OBJECT_CLASS (tpaw_user_info_parent_class)->constructed (object);

  gtk_grid_set_column_spacing (grid, 6);
  gtk_grid_set_row_spacing (grid, 6);

  infobar = gtk_info_bar_new ();
  g_object_set (infobar, "margin-bottom", 6, NULL);
  gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), GTK_MESSAGE_INFO);
  infobar_content = gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar));
  infobar_label = gtk_label_new (
      _("These details will be shared with other users on this "
        "chat network."));
  gtk_container_add (GTK_CONTAINER (infobar_content), infobar_label);
  gtk_widget_show (infobar_label);
  gtk_grid_attach_next_to ((GtkGrid *) self, infobar, NULL,
      GTK_POS_TOP, 3, 1);
  gtk_widget_show (infobar);

  /* Setup id label */
  title = gtk_label_new (_("Identifier"));
  self->priv->identifier_label = gtk_label_new (
      tp_account_get_normalized_name (self->priv->account));
  add_row (grid, title, self->priv->identifier_label, FALSE);
  g_signal_connect_object (self->priv->account, "notify::normalized-name",
      G_CALLBACK (identifier_notify_cb), self, 0);

  /* Setup nickname entry */
  title = gtk_label_new (_("Alias"));
  self->priv->nickname_entry = gtk_entry_new ();
  gtk_entry_set_text (GTK_ENTRY (self->priv->nickname_entry),
      tp_account_get_nickname (self->priv->account));
  add_row (grid, title, self->priv->nickname_entry, FALSE);
  g_signal_connect_object (self->priv->account, "notify::nickname",
      G_CALLBACK (nickname_notify_cb), self, 0);

  /* Set up avatar chooser */
  self->priv->avatar_chooser = tpaw_avatar_chooser_new (self->priv->account,
      -1);
  gtk_grid_attach (grid, self->priv->avatar_chooser,
      2, 0, 1, 3);
  gtk_widget_show (self->priv->avatar_chooser);

  /* Details label */
  self->priv->details_label = gtk_label_new (NULL);
  gtk_label_set_markup (GTK_LABEL (self->priv->details_label),
      _("<b>Personal Details</b>"));
  gtk_misc_set_alignment (GTK_MISC (self->priv->details_label), 0, 0.5);
  gtk_grid_attach_next_to (grid, self->priv->details_label, NULL,
      GTK_POS_BOTTOM, 3, 1);

  /* Details spinner */
  self->priv->details_spinner = gtk_spinner_new ();
  gtk_widget_set_hexpand (self->priv->details_spinner, TRUE);
  gtk_widget_set_vexpand (self->priv->details_spinner, TRUE);
  gtk_grid_attach_next_to (grid, self->priv->details_spinner, NULL,
      GTK_POS_BOTTOM, 3, 1);

  g_signal_connect_swapped (self->priv->account, "notify::connection",
      G_CALLBACK (connection_notify_cb), self);
  connection_notify_cb (self);
}
Пример #5
0
EaseSlideButtonPanel* ease_slide_button_panel_construct (GType object_type, EaseDocument* d, EaseEditorWindow* win) {
#line 238 "ease-slide-button-panel.c"
	EaseSlideButtonPanel * self;
	EaseDocument* _tmp0_;
	EaseEditorWindow* _tmp1_;
	GtkTreeView* _tmp2_;
	GtkCellRendererPixbuf* _tmp3_;
	GtkViewport* viewport;
	EaseSlide* s;
#line 63 "ease-slide-button-panel.vala"
	g_return_val_if_fail (d != NULL, NULL);
#line 63 "ease-slide-button-panel.vala"
	g_return_val_if_fail (win != NULL, NULL);
#line 250 "ease-slide-button-panel.c"
	self = g_object_newv (object_type, 0, NULL);
#line 65 "ease-slide-button-panel.vala"
	self->priv->document = (_tmp0_ = _g_object_ref0 (d), _g_object_unref0 (self->priv->document), _tmp0_);
#line 66 "ease-slide-button-panel.vala"
	self->priv->owner = (_tmp1_ = _g_object_ref0 (win), _g_object_unref0 (self->priv->owner), _tmp1_);
#line 67 "ease-slide-button-panel.vala"
	g_object_set ((GtkWidget*) self, "width-request", EASE_SLIDE_BUTTON_PANEL_WIDTH_REQUEST, NULL);
#line 70 "ease-slide-button-panel.vala"
	g_object_set ((GtkScrolledWindow*) self, "vscrollbar-policy", GTK_POLICY_AUTOMATIC, NULL);
#line 71 "ease-slide-button-panel.vala"
	g_object_set ((GtkScrolledWindow*) self, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
#line 72 "ease-slide-button-panel.vala"
	gtk_scrolled_window_set_shadow_type ((GtkScrolledWindow*) self, GTK_SHADOW_IN);
#line 75 "ease-slide-button-panel.vala"
	self->priv->slides = (_tmp2_ = g_object_ref_sink ((GtkTreeView*) gtk_tree_view_new ()), _g_object_unref0 (self->priv->slides), _tmp2_);
#line 76 "ease-slide-button-panel.vala"
	gtk_tree_view_set_reorderable (self->priv->slides, TRUE);
#line 77 "ease-slide-button-panel.vala"
	gtk_tree_view_set_headers_visible (self->priv->slides, FALSE);
#line 78 "ease-slide-button-panel.vala"
	self->priv->renderer = (_tmp3_ = g_object_ref_sink ((GtkCellRendererPixbuf*) gtk_cell_renderer_pixbuf_new ()), _g_object_unref0 (self->priv->renderer), _tmp3_);
#line 79 "ease-slide-button-panel.vala"
	gtk_cell_renderer_set_padding ((GtkCellRenderer*) self->priv->renderer, EASE_SLIDE_BUTTON_PANEL_PADDING, EASE_SLIDE_BUTTON_PANEL_PADDING);
#line 80 "ease-slide-button-panel.vala"
	gtk_tree_view_insert_column_with_attributes (self->priv->slides, -1, "Slides", (GtkCellRenderer*) self->priv->renderer, "pixbuf", EASE_DOCUMENT_COL_PIXBUF, NULL);
#line 82 "ease-slide-button-panel.vala"
	gtk_tree_view_set_model (self->priv->slides, (GtkTreeModel*) ease_document_get_slides (self->priv->document));
#line 86 "ease-slide-button-panel.vala"
	viewport = g_object_ref_sink ((GtkViewport*) gtk_viewport_new (NULL, NULL));
#line 87 "ease-slide-button-panel.vala"
	gtk_viewport_set_shadow_type (viewport, GTK_SHADOW_NONE);
#line 88 "ease-slide-button-panel.vala"
	gtk_container_add ((GtkContainer*) viewport, (GtkWidget*) self->priv->slides);
#line 89 "ease-slide-button-panel.vala"
	gtk_container_add ((GtkContainer*) self, (GtkWidget*) viewport);
#line 286 "ease-slide-button-panel.c"
	s = NULL;
	{
		EaseIterableTreeModelIterator* _itr_it;
#line 93 "ease-slide-button-panel.vala"
		_itr_it = ease_iterable_tree_model_iterator ((EaseIterableTreeModel*) ease_document_get_slides (self->priv->document));
#line 93 "ease-slide-button-panel.vala"
		while (TRUE) {
#line 294 "ease-slide-button-panel.c"
			GtkTreeIter _tmp4_ = {0};
			GtkTreeIter itr;
#line 93 "ease-slide-button-panel.vala"
			if (!ease_iterable_tree_model_iterator_next (_itr_it)) {
#line 93 "ease-slide-button-panel.vala"
				break;
#line 301 "ease-slide-button-panel.c"
			}
#line 93 "ease-slide-button-panel.vala"
			itr = (ease_iterable_tree_model_iterator_get (_itr_it, &_tmp4_), _tmp4_);
#line 95 "ease-slide-button-panel.vala"
			ease_slide_button_panel_slide_redraw (self, &itr);
#line 96 "ease-slide-button-panel.vala"
			gtk_tree_model_get ((GtkTreeModel*) ease_document_get_slides (self->priv->document), &itr, EASE_DOCUMENT_COL_SLIDE, &s, -1);
#line 97 "ease-slide-button-panel.vala"
			g_signal_connect_object (s, "changed", (GCallback) _ease_slide_button_panel_on_slide_changed_ease_slide_changed, self, 0);
#line 98 "ease-slide-button-panel.vala"
			g_signal_connect_object (s, "background-changed", (GCallback) _ease_slide_button_panel_on_slide_changed_ease_slide_background_changed, self, 0);
#line 313 "ease-slide-button-panel.c"
		}
		_ease_iterable_tree_model_iterator_unref0 (_itr_it);
	}
#line 102 "ease-slide-button-panel.vala"
	g_signal_connect_object (gtk_tree_view_get_selection (self->priv->slides), "changed", (GCallback) __lambda4__gtk_tree_selection_changed, self, 0);
#line 110 "ease-slide-button-panel.vala"
	g_signal_connect_object (self->priv->document, "slide-added", (GCallback) __lambda47__ease_document_slide_added, self, 0);
#line 116 "ease-slide-button-panel.vala"
	g_signal_connect_object (self->priv->document, "slide-deleted", (GCallback) __lambda48__ease_document_slide_deleted, self, 0);
#line 323 "ease-slide-button-panel.c"
	_g_object_unref0 (s);
	_g_object_unref0 (viewport);
	return self;
}
Пример #6
0
/*  private function of gimp_unit_menu_callback ()  */
static void
gimp_unit_menu_create_selection (GimpUnitMenu *menu)
{
  GtkWidget        *parent = gtk_widget_get_toplevel (GTK_WIDGET (menu));
  GtkWidget        *vbox;
  GtkWidget        *scrolled_win;
  GtkListStore     *list;
  GtkTreeSelection *sel;
  GtkTreeIter       iter;
  GtkTreePath      *path;
  GtkDialogFlags    flags  = GTK_DIALOG_DESTROY_WITH_PARENT;
  GimpUnit          unit;
  gint              num_units;

  if (gtk_window_get_modal (GTK_WINDOW (parent)))
    flags |= GTK_DIALOG_MODAL;

  menu->selection = gimp_dialog_new (_("Unit Selection"), "gimp-unit-selection",
                                     parent, flags,
                                     gimp_standard_help_func,
                                     "gimp-unit-dialog",

                                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                     GTK_STOCK_OK,     GTK_RESPONSE_OK,

                                     NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (menu->selection),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  g_object_add_weak_pointer (G_OBJECT (menu->selection),
                             (gpointer) &menu->selection);

  g_signal_connect (menu->selection, "response",
                    G_CALLBACK (gimp_unit_menu_selection_response),
                    menu);

  g_signal_connect_object (menu, "unmap",
                           G_CALLBACK (gtk_widget_destroy),
                           menu->selection, G_CONNECT_SWAPPED);

  /*  the main vbox  */
  vbox = gtk_vbox_new (FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (menu->selection))),
                      vbox, TRUE, TRUE, 0);
  gtk_widget_show (vbox);

  /*  the selection list  */
  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_win),
                                       GTK_SHADOW_ETCHED_IN);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
                                  GTK_POLICY_NEVER,
                                  GTK_POLICY_ALWAYS);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
  gtk_widget_show (scrolled_win);

  list = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
                             G_TYPE_INT);
  menu->tv = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list));
  g_object_unref (list);

  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (menu->tv),
                                               -1, _("Unit"),
                                               gtk_cell_renderer_text_new (),
                                               "text", UNIT_COLUMN, NULL);
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (menu->tv),
                                               -1, _("Factor"),
                                               gtk_cell_renderer_text_new (),
                                               "text", FACTOR_COLUMN, NULL);

  /*  the unit lines  */
  num_units = gimp_unit_get_number_of_units ();
  for (unit = GIMP_UNIT_END; unit < num_units; unit++)
    {
      gchar *string;

      gtk_list_store_append (list, &iter);

      string = gimp_unit_format_string (menu->format, unit);
      gtk_list_store_set (list, &iter,
                          UNIT_COLUMN, string,
                          -1);
      g_free (string);

      string = gimp_unit_format_string ("(%f)", unit);
      gtk_list_store_set (list, &iter,
                          FACTOR_COLUMN, string,
                          -1);
      g_free (string);

      gtk_list_store_set (list, &iter, DATA_COLUMN, unit, -1);
    }

  gtk_widget_set_size_request (menu->tv, -1, 150);

  gtk_container_add (GTK_CONTAINER (scrolled_win), menu->tv);

  g_signal_connect (menu->tv, "row-activated",
                    G_CALLBACK (gimp_unit_menu_selection_row_activated_callback),
                    menu);

  gtk_widget_show (menu->tv);

  g_signal_connect (menu->tv, "destroy",
                    G_CALLBACK (gtk_widget_destroyed),
                    &menu->tv);

  gtk_widget_show (vbox);
  gtk_widget_show (menu->selection);

  if (menu->unit >= GIMP_UNIT_END)
    {
      path = gtk_tree_path_new ();
      gtk_tree_path_append_index (path, menu->unit - GIMP_UNIT_END);

      sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (menu->tv));
      gtk_tree_selection_select_path (sel, path);

      gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (menu->tv), path, NULL,
                                    FALSE, 0.0, 0.0);
    }
}
Пример #7
0
static void
gtk_source_map_init (GtkSourceMap *map)
{
	GtkSourceMapPrivate *priv;
	GtkSourceCompletion *completion;
	GtkStyleContext *context;

	priv = gtk_source_map_get_instance_private (map);

	priv->css_provider = gtk_css_provider_new ();

	context = gtk_widget_get_style_context (GTK_WIDGET (map));
	gtk_style_context_add_provider (context,
	                                GTK_STYLE_PROVIDER (priv->css_provider),
	                                CSS_PRIORITY);

	priv->child_view = g_object_new (GTK_SOURCE_TYPE_VIEW,
	                                 "auto-indent", FALSE,
	                                 "can-focus", FALSE,
	                                 "draw-spaces", 0,
	                                 "editable", FALSE,
	                                 "expand", FALSE,
	                                 "monospace", TRUE,
	                                 "show-line-numbers", FALSE,
	                                 "show-line-marks", FALSE,
	                                 "show-right-margin", FALSE,
	                                 "visible", TRUE,
	                                 NULL);

	context = gtk_widget_get_style_context (GTK_WIDGET (priv->child_view));
	gtk_style_context_add_provider (context,
	                                GTK_STYLE_PROVIDER (priv->css_provider),
	                                CSS_PRIORITY);

	g_signal_connect_object (priv->child_view,
	                         "button-press-event",
	                         G_CALLBACK (child_view_button_press_event),
	                         map,
	                         G_CONNECT_SWAPPED);
	gtk_widget_add_events (GTK_WIDGET (priv->child_view), GDK_SCROLL_MASK);
	g_signal_connect_object (priv->child_view,
	                         "scroll-event",
	                         G_CALLBACK (child_view_scroll_event),
	                         map,
	                         G_CONNECT_SWAPPED);
	g_signal_connect_object (priv->child_view,
	                         "state-flags-changed",
	                         G_CALLBACK (child_view_state_flags_changed),
	                         map,
	                         G_CONNECT_SWAPPED | G_CONNECT_AFTER);
	g_signal_connect_object (priv->child_view,
	                         "realize",
	                         G_CALLBACK (child_view_realize_after),
	                         map,
	                         G_CONNECT_SWAPPED | G_CONNECT_AFTER);
	g_signal_connect_object (priv->child_view,
	                         "button-press-event",
	                         G_CALLBACK (child_view_button_press_event),
	                         map,
	                         G_CONNECT_SWAPPED);
	g_signal_connect_object (priv->child_view,
	                         "button-release-event",
	                         G_CALLBACK (child_view_button_release_event),
	                         map,
	                         G_CONNECT_SWAPPED);
	g_signal_connect_object (priv->child_view,
	                         "motion-notify-event",
	                         G_CALLBACK (child_view_motion_notify_event),
	                         map,
	                         G_CONNECT_SWAPPED);

	gtk_container_add (GTK_CONTAINER (map), GTK_WIDGET (priv->child_view));

	completion = gtk_source_view_get_completion (priv->child_view);
	gtk_source_completion_block_interactive (completion);

	gtk_source_map_set_font_name (map, "Monospace 1");
}
Пример #8
0
void
view_actions_setup (GimpActionGroup *group)
{
  GtkAction *action;

  gimp_action_group_add_actions (group, "view-action",
                                 view_actions,
                                 G_N_ELEMENTS (view_actions));

  gimp_action_group_add_toggle_actions (group, "view-action",
                                        view_toggle_actions,
                                        G_N_ELEMENTS (view_toggle_actions));

  gimp_action_group_add_enum_actions (group, "view-zoom-action",
                                      view_zoom_actions,
                                      G_N_ELEMENTS (view_zoom_actions),
                                      G_CALLBACK (view_zoom_cmd_callback));

  gimp_action_group_add_radio_actions (group, "view-zoom-action",
                                       view_zoom_explicit_actions,
                                       G_N_ELEMENTS (view_zoom_explicit_actions),
                                       NULL,
                                       10000,
                                       G_CALLBACK (view_zoom_explicit_cmd_callback));

  gimp_action_group_add_enum_actions (group, "view-padding-color",
                                      view_padding_color_actions,
                                      G_N_ELEMENTS (view_padding_color_actions),
                                      G_CALLBACK (view_padding_color_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      view_scroll_horizontal_actions,
                                      G_N_ELEMENTS (view_scroll_horizontal_actions),
                                      G_CALLBACK (view_scroll_horizontal_cmd_callback));

  gimp_action_group_add_enum_actions (group, NULL,
                                      view_scroll_vertical_actions,
                                      G_N_ELEMENTS (view_scroll_vertical_actions),
                                      G_CALLBACK (view_scroll_vertical_cmd_callback));

  /*  connect "activate" of view-zoom-other manually so it can be
   *  selected even if it's the active item of the radio group
   */
  action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                        "view-zoom-other");
  g_signal_connect (action, "activate",
                    G_CALLBACK (view_zoom_other_cmd_callback),
                    group->user_data);

  g_signal_connect_object (group->gimp->config, "notify::check-type",
                           G_CALLBACK (view_actions_check_type_notify),
                           group, 0);
  view_actions_check_type_notify (GIMP_DISPLAY_CONFIG (group->gimp->config),
                                  NULL, group);

  if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
      GIMP_IS_GIMP (group->user_data))
    {
      /*  add window actions only if the context of the group is
       *  the display itself or the global popup (not if the context
       *  is a dock)
       *  (see dock-actions.c)
       */
      window_actions_setup (group, GIMP_HELP_VIEW_CHANGE_SCREEN);
    }
}
Пример #9
0
static void
bt_settings_page_interaction_controller_init_ui (const
    BtSettingsPageInteractionController * self, GtkWidget * pages)
{
  GtkWidget *label, *widget, *scrolled_window;
  GtkCellRenderer *renderer;
  GtkTreeViewColumn *tree_col;
  GtkTreeSelection *tree_sel;
  BtIcRegistry *ic_registry;
  gchar *str;

  gtk_widget_set_name (GTK_WIDGET (self), "interaction controller settings");

  // create the widget already so that we can set the initial text
  self->priv->message = GTK_LABEL (gtk_label_new (NULL));
  g_object_set (GTK_WIDGET (self->priv->message), "hexpand", TRUE, NULL);

  // add setting widgets
  label = gtk_label_new (NULL);
  str = g_strdup_printf ("<big><b>%s</b></big>", _("Interaction Controller"));
  gtk_label_set_markup (GTK_LABEL (label), str);
  g_free (str);
  g_object_set (label, "xalign", 0.0, NULL);
  gtk_grid_attach (GTK_GRID (self), label, 0, 0, 3, 1);
  gtk_grid_attach (GTK_GRID (self), gtk_label_new ("    "), 0, 1, 1, 3);

  label = gtk_label_new (_("Device"));
  g_object_set (label, "xalign", 1.0, NULL);
  gtk_grid_attach (GTK_GRID (self), label, 1, 1, 1, 1);

  widget = gtk_combo_box_new ();
  self->priv->device_menu = GTK_COMBO_BOX (widget);
  renderer = gtk_cell_renderer_text_new ();
  gtk_cell_renderer_set_fixed_size (renderer, 1, -1);
  gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT
      (renderer), 1);
  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->priv->device_menu),
      renderer, TRUE);
  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (self->priv->device_menu),
      renderer, "text", DEVICE_MENU_LABEL, NULL);

  // get list of devices from libbtic and listen to changes
  g_object_get (self->priv->app, "ic-registry", &ic_registry, NULL);
  g_signal_connect_object (ic_registry, "notify::devices",
      G_CALLBACK (on_ic_registry_devices_changed), (gpointer) self, 0);
  g_object_unref (ic_registry);
  g_object_set (widget, "hexpand", TRUE, "margin-left", LABEL_PADDING, NULL);
  gtk_grid_attach (GTK_GRID (self), widget, 2, 1, 1, 1);
  g_signal_connect (widget, "changed",
      G_CALLBACK (on_device_menu_changed), (gpointer) self);

  // add list of controllers (updated when selecting a device)
  scrolled_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
      GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
      GTK_SHADOW_ETCHED_IN);
  self->priv->controller_list = GTK_TREE_VIEW (gtk_tree_view_new ());
  g_object_set (self->priv->controller_list,
      "enable-search", FALSE, "rules-hint", TRUE, NULL);

  // have this first as the last column gets the remaining space (always :/)
  renderer = gtk_cell_renderer_toggle_new ();
  gtk_tree_view_insert_column_with_attributes (self->priv->controller_list, -1,
      _("In use"), renderer, "active", CONTROLLER_LIST_USED, NULL);

  self->priv->id_renderer = renderer = gtk_cell_renderer_text_new ();
  //gtk_cell_renderer_set_fixed_size (renderer, 1, -1);
  gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT
      (renderer), 1);
  g_signal_connect (renderer, "edited", G_CALLBACK (on_control_name_edited),
      (gpointer) self);
  if ((tree_col =
          gtk_tree_view_column_new_with_attributes (_("Controller"), renderer,
              "text", CONTROLLER_LIST_LABEL, NULL))
      ) {
    g_object_set (tree_col, "expand", TRUE, NULL);
    gtk_tree_view_insert_column (self->priv->controller_list, tree_col, -1);
  } else
    GST_WARNING ("can't create treeview column");

  tree_sel = gtk_tree_view_get_selection (self->priv->controller_list);
  gtk_tree_selection_set_mode (tree_sel, GTK_SELECTION_BROWSE);
  g_signal_connect (tree_sel, "changed", G_CALLBACK (on_control_selected),
      (gpointer) self);

  gtk_container_add (GTK_CONTAINER (scrolled_window),
      GTK_WIDGET (self->priv->controller_list));
  g_object_set (GTK_WIDGET (scrolled_window), "hexpand", TRUE, "vexpand", TRUE,
      "margin-left", LABEL_PADDING, NULL);
  gtk_grid_attach (GTK_GRID (self), GTK_WIDGET (scrolled_window), 1, 2, 2, 1);

  // add a message pane
#if ! defined(USE_GUDEV) && ! defined(USE_ALSA)
  gtk_label_set_text (self->priv->message,
      _("This package has been built without GUdev and Alsa support and thus "
          "supports no interaction controllers."));
#endif
  gtk_grid_attach (GTK_GRID (self), GTK_WIDGET (self->priv->message), 0, 3, 3,
      1);

  // listen to page changes
  g_signal_connect ((gpointer) pages, "notify::page",
      G_CALLBACK (on_page_switched), (gpointer) self);

  // initial refresh
  on_ic_registry_devices_changed (ic_registry, NULL, (gpointer) self);
}
Пример #10
0
void
e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
{
	ETaskShellViewPrivate *priv = task_shell_view->priv;
	EShellBackend *shell_backend;
	EShellContent *shell_content;
	EShellSidebar *shell_sidebar;
	EShellWindow *shell_window;
	EShellView *shell_view;
	EShell *shell;
	gulong handler_id;

	shell_view = E_SHELL_VIEW (task_shell_view);
	shell_backend = e_shell_view_get_shell_backend (shell_view);
	shell_content = e_shell_view_get_shell_content (shell_view);
	shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
	shell_window = e_shell_view_get_shell_window (shell_view);
	shell = e_shell_window_get_shell (shell_window);

	e_shell_window_add_action_group (shell_window, "tasks");
	e_shell_window_add_action_group (shell_window, "tasks-filter");

	/* Cache these to avoid lots of awkward casting. */
	priv->task_shell_backend = g_object_ref (shell_backend);
	priv->task_shell_content = g_object_ref (shell_content);
	priv->task_shell_sidebar = g_object_ref (shell_sidebar);

	priv->settings = g_settings_new ("org.gnome.evolution.calendar");

	handler_id = g_signal_connect_object (
		priv->task_shell_sidebar, "client-added",
		G_CALLBACK (task_shell_view_selector_client_added_cb),
		task_shell_view, G_CONNECT_SWAPPED);
	priv->client_added_handler_id = handler_id;

	handler_id = g_signal_connect_object (
		priv->task_shell_sidebar, "client-removed",
		G_CALLBACK (task_shell_view_selector_client_removed_cb),
		task_shell_view, G_CONNECT_SWAPPED);
	priv->client_removed_handler_id = handler_id;

	/* Keep our own reference to this so we can
	 * disconnect our signal handlers in dispose(). */
	priv->client_cache = e_shell_get_client_cache (shell);
	g_object_ref (priv->client_cache);

	handler_id = g_signal_connect (
		priv->client_cache, "backend-error",
		G_CALLBACK (task_shell_view_backend_error_cb),
		task_shell_view);
	priv->backend_error_handler_id = handler_id;

	/* Keep our own reference to this so we can
	 * disconnect our signal handlers in dispose(). */
	priv->task_table = e_task_shell_content_get_task_table (
		E_TASK_SHELL_CONTENT (shell_content));
	g_object_ref (priv->task_table);

	handler_id = g_signal_connect_swapped (
		priv->task_table, "open-component",
		G_CALLBACK (e_task_shell_view_open_task),
		task_shell_view);
	priv->open_component_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->task_table, "popup-event",
		G_CALLBACK (task_shell_view_table_popup_event_cb),
		task_shell_view);
	priv->popup_event_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->task_table, "selection-change",
		G_CALLBACK (e_task_shell_view_update_sidebar),
		task_shell_view);
	priv->selection_change_1_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->task_table, "selection-change",
		G_CALLBACK (e_shell_view_update_actions),
		task_shell_view);
	priv->selection_change_2_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->task_table, "status-message",
		G_CALLBACK (e_task_shell_view_set_status_message),
		task_shell_view);
	priv->status_message_handler_id = handler_id;

	/* Keep our own reference to this so we can
	 * disconnect our signal handlers in dispose(). */
	priv->model = e_task_table_get_model (priv->task_table);
	g_object_ref (priv->model);

	handler_id = g_signal_connect_swapped (
		priv->model, "model-changed",
		G_CALLBACK (e_task_shell_view_update_sidebar),
		task_shell_view);
	priv->model_changed_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->model, "model-rows-deleted",
		G_CALLBACK (e_task_shell_view_update_sidebar),
		task_shell_view);
	priv->model_rows_deleted_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->model, "model-rows-inserted",
		G_CALLBACK (e_task_shell_view_update_sidebar),
		task_shell_view);
	priv->model_rows_inserted_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->model, "row-appended",
		G_CALLBACK (task_shell_view_model_row_appended_cb),
		task_shell_view);
	priv->rows_appended_handler_id = handler_id;

	/* Keep our own reference to this so we can
	 * disconnect our signal handlers in dispose(). */
	priv->selector = e_task_shell_sidebar_get_selector (
		E_TASK_SHELL_SIDEBAR (shell_sidebar));
	g_object_ref (priv->selector);

	handler_id = g_signal_connect_swapped (
		priv->selector, "popup-event",
		G_CALLBACK (task_shell_view_selector_popup_event_cb),
		task_shell_view);
	priv->selector_popup_event_handler_id = handler_id;

	handler_id = g_signal_connect_swapped (
		priv->selector, "primary-selection-changed",
		G_CALLBACK (e_shell_view_update_actions),
		task_shell_view);
	priv->primary_selection_changed_handler_id = handler_id;

	e_categories_add_change_hook (
		(GHookFunc) e_task_shell_view_update_search_filter,
		task_shell_view);

	/* Listen for configuration changes. */
	g_settings_bind (
		priv->settings, "confirm-purge",
		shell_view, "confirm-purge",
		G_SETTINGS_BIND_DEFAULT);

	/* Keep the ECalModel in sync with the sidebar. */
	g_object_bind_property (
		shell_sidebar, "default-client",
		priv->model, "default-client",
		G_BINDING_SYNC_CREATE);

	/* Hide Completed Tasks (enable/units/value) */
	handler_id = g_signal_connect (
		priv->settings, "changed::hide-completed-tasks",
		G_CALLBACK (task_shell_view_hide_completed_tasks_changed_cb),
		task_shell_view);
	priv->settings_hide_completed_tasks_handler_id = handler_id;
	handler_id = g_signal_connect (
		priv->settings, "changed::hide-completed-tasks-units",
		G_CALLBACK (task_shell_view_hide_completed_tasks_changed_cb),
		task_shell_view);
	priv->settings_hide_completed_tasks_units_handler_id = handler_id;
	handler_id = g_signal_connect (
		priv->settings, "changed::hide-completed-tasks-value",
		G_CALLBACK (task_shell_view_hide_completed_tasks_changed_cb),
		task_shell_view);
	priv->settings_hide_completed_tasks_value_handler_id = handler_id;

	e_task_shell_view_actions_init (task_shell_view);
	e_task_shell_view_update_sidebar (task_shell_view);
	e_task_shell_view_update_search_filter (task_shell_view);

	/* Call this when everything is ready, like actions in
	 * action groups and such. */
	task_shell_view_update_timeout_cb (task_shell_view);
	priv->update_timeout = e_named_timeout_add_full (
		G_PRIORITY_LOW, 60000,
		task_shell_view_update_timeout_cb,
		task_shell_view, NULL);
}
Пример #11
0
GtkWidget *
gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
{
  GObject         *config = G_OBJECT (tool_options);
  GtkWidget       *vbox   = gimp_selection_options_gui (tool_options);
  GtkWidget       *hbox;
  GtkWidget       *button;
  GtkWidget       *frame;
  GtkWidget       *scale;
  GtkWidget       *combo;
  GtkWidget       *table;
  gchar           *title;
  gint             row = 0;
  GimpForegroundSelectOptions *options = GIMP_FOREGROUND_SELECT_OPTIONS (config);

  frame = gimp_prop_enum_radio_frame_new (config, "draw-mode", title, 
                                          0,0);

  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);


  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);


  /* stroke width */  
  scale = gimp_prop_spin_scale_new (config, "stroke-width",
                                        _("Stroke width"),
                                        1.0, 10.0, 2);
  gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 1.0, 1000.0);
  gimp_spin_scale_set_gamma (GIMP_SPIN_SCALE (scale), 1.7);
  gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0);
  gtk_widget_show (scale);

  button = gimp_stock_button_new (GIMP_STOCK_RESET, NULL);
  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
  gtk_image_set_from_stock (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (button))),
                            GIMP_STOCK_RESET, GTK_ICON_SIZE_MENU);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
  gtk_widget_show (button);

  g_signal_connect (button, "clicked",
                        G_CALLBACK (gimp_foreground_select_options_gui_reset_stroke_width),
                        tool_options);
  
  gimp_help_set_help_data (button,
                           _("Reset stroke width native size"), NULL);

  /*  mask color */
  frame = gimp_frame_new (_("Preview color:"));
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  combo = gimp_prop_enum_combo_box_new (config, "mask-color", 
                                        GIMP_RED_CHANNEL, GIMP_GRAY_CHANNEL);
  gtk_container_add (GTK_CONTAINER (frame), combo);
  gtk_widget_show (combo);
  
  /* engine */
  frame = gimp_frame_new (_("Engine:"));
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  combo = gimp_prop_enum_combo_box_new (config, "engine", 0, 0);
  gtk_container_add (GTK_CONTAINER (frame), combo);
  gtk_widget_show (combo);


  /*  parameters  */

  table = gtk_table_new (3, 3, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);
  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
  gtk_widget_show (table);

  options->dynamic_widgets.levels =  gimp_prop_scale_entry_new (config, "levels",
                               GTK_TABLE (table), 0, row++, "Levels", 1, 1, 0, FALSE, 0, 0);
  options->dynamic_widgets.active_levels = gimp_prop_scale_entry_new (config, "active-levels",
                               GTK_TABLE (table), 0, row++, "Act. Levels", 1, 1, 0, FALSE, 0, 0);
  options->dynamic_widgets.iterations = gimp_prop_scale_entry_new (config, "iterations",
                               GTK_TABLE (table), 0, row++, "Iterations", 1, 1, 0, FALSE, 0, 0);
  
  g_signal_connect_object (config, "notify::engine",
                           G_CALLBACK (gimp_foreground_select_notify_engine),
                           NULL, 0);
  gimp_foreground_select_notify_engine(tool_options,NULL,NULL);
  

  return vbox;
}
Пример #12
0
static GtkWidget *
build_tab_label (NautilusNotebook *nb, NautilusWindowSlot *slot)
{
	GtkWidget *hbox, *label, *close_button, *image, *spinner, *icon;
	GtkWidget *box;

	box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
	gtk_widget_show (box);

	/* set hbox spacing and label padding (see below) so that there's an
	 * equal amount of space around the label */
	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
	gtk_widget_show (hbox);
	gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
	gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0);

	/* setup load feedback */
	spinner = gtk_spinner_new ();
	gtk_box_pack_start (GTK_BOX (hbox), spinner, FALSE, FALSE, 0);

	/* setup site icon, empty by default */
	icon = gtk_image_new ();
	gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0);
	/* don't show the icon */

	/* setup label */
	label = gtk_label_new (NULL);
	gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
	gtk_label_set_single_line_mode (GTK_LABEL (label), TRUE);
        gtk_label_set_xalign (GTK_LABEL (label), 0.5);
        gtk_label_set_yalign (GTK_LABEL (label), 0.5);
	gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
	gtk_widget_show (label);

	/* setup close button */
	close_button = gtk_button_new ();
	gtk_button_set_relief (GTK_BUTTON (close_button),
			       GTK_RELIEF_NONE);
	/* don't allow focus on the close button */
	gtk_widget_set_focus_on_click (close_button, FALSE);

	gtk_widget_set_name (close_button, "nautilus-tab-close-button");

	image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
	gtk_widget_set_tooltip_text (close_button, _("Close tab"));
	g_signal_connect_object (close_button, "clicked",
				 G_CALLBACK (close_button_clicked_cb), slot, 0);

	gtk_container_add (GTK_CONTAINER (close_button), image);
	gtk_widget_show (image);

	gtk_box_pack_start (GTK_BOX (box), close_button, FALSE, FALSE, 0);
	gtk_widget_show (close_button);

	g_object_set_data (G_OBJECT (box), "nautilus-notebook-tab", GINT_TO_POINTER (1));
	nautilus_drag_slot_proxy_init (box, NULL, slot);

	g_object_set_data (G_OBJECT (box), "label", label);
	g_object_set_data (G_OBJECT (box), "spinner", spinner);
	g_object_set_data (G_OBJECT (box), "icon", icon);
	g_object_set_data (G_OBJECT (box), "close-button", close_button);

	return box;
}
Пример #13
0
static void
display_sync_settings_dialog (RBMediaPlayerSource *source)
{
	RBMediaPlayerSourcePrivate *priv = MEDIA_PLAYER_SOURCE_GET_PRIVATE (source);
	GtkWidget *content;
	GtkWidget *widget;
	GtkBuilder *builder;
	const char *ui_file;
	char *name;
	char *title;

	g_object_get (source, "name", &name, NULL);
	title = g_strdup_printf (_("%s Sync Settings"), name);

	priv->sync_dialog = gtk_dialog_new_with_buttons (title,
							 NULL,
							 0,
							 _("Sync with the device"),
							 GTK_RESPONSE_YES,
							 _("Don't sync"),
							 GTK_RESPONSE_CANCEL,
							 NULL);
	g_free (title);

	priv->sync_dialog_update_id = g_signal_connect_object (priv->sync_state,
							       "updated",
							       G_CALLBACK (sync_dialog_state_update),
							       source, 0);
	g_signal_connect_object (priv->sync_dialog,
				 "response",
				 G_CALLBACK (sync_confirm_dialog_cb),
				 source, 0);

	/* display the sync settings, the sync state, and some helpful text indicating why
	 * we're not syncing already
	 */
	content = gtk_dialog_get_content_area (GTK_DIALOG (priv->sync_dialog));

	ui_file = rb_file ("sync-dialog.ui");
	if (ui_file == NULL) {
		g_warning ("Couldn't find sync-state.ui");
		gtk_widget_show_all (priv->sync_dialog);
		return;
	}

	builder = rb_builder_load (ui_file, NULL);
	if (builder == NULL) {
		g_warning ("Couldn't load sync-state.ui");
		gtk_widget_show_all (priv->sync_dialog);
		return;
	}

	priv->sync_dialog_label = GTK_WIDGET (gtk_builder_get_object (builder, "sync-dialog-reason"));
	priv->sync_dialog_error_box = GTK_WIDGET (gtk_builder_get_object (builder, "sync-dialog-message"));

	widget = GTK_WIDGET (gtk_builder_get_object (builder, "sync-settings-ui-container"));
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (widget), rb_sync_settings_ui_new (source, priv->sync_settings));

	widget = GTK_WIDGET (gtk_builder_get_object (builder, "sync-state-ui-container"));
	gtk_box_pack_start (GTK_BOX (widget), rb_sync_state_ui_new (priv->sync_state), TRUE, TRUE, 0);

	widget = GTK_WIDGET (gtk_builder_get_object (builder, "sync-dialog"));
	gtk_box_pack_start (GTK_BOX (content), widget, TRUE, TRUE, 0);

	gtk_widget_show_all (priv->sync_dialog);
	update_sync_settings_dialog (source);
	g_object_unref (builder);
}
Пример #14
0
void
rb_media_player_source_show_properties (RBMediaPlayerSource *source)
{
	RBMediaPlayerSourcePrivate *priv = MEDIA_PLAYER_SOURCE_GET_PRIVATE (source);
	RBMediaPlayerSourceClass *klass = RB_MEDIA_PLAYER_SOURCE_GET_CLASS (source);
	GtkBuilder *builder;
	GtkContainer *container;
	const char *ui_file;
	char *name;
	char *text;

	if (priv->properties_dialog != NULL) {
		gtk_window_present (GTK_WINDOW (priv->properties_dialog));
		return;
	}

	/* load dialog UI */
	ui_file = rb_file ("media-player-properties.ui");
	if (ui_file == NULL) {
		g_warning ("Couldn't find media-player-properties.ui");
		return;
	}

	builder = rb_builder_load (ui_file, NULL);
	if (builder == NULL) {
		g_warning ("Couldn't load media-player-properties.ui");
		return;
	}

	priv->properties_dialog = GTK_DIALOG (gtk_builder_get_object (builder, "media-player-properties"));
	g_object_ref (priv->properties_dialog);
	g_signal_connect_object (priv->properties_dialog,
				 "response",
				 G_CALLBACK (properties_dialog_response_cb),
				 source, 0);

	g_object_get (source, "name", &name, NULL);
	text = g_strdup_printf (_("%s Properties"), name);
	gtk_window_set_title (GTK_WINDOW (priv->properties_dialog), text);
	g_free (text);
	g_free (name);

	/* ensure device usage information is available and up to date */
	update_sync (source);

	/*
	 * fill in some common details:
	 * - volume usage (need to hook up signals etc. to update this live)
	 */
	rb_sync_state_ui_create_bar (&priv->volume_usage, rb_media_player_source_get_capacity (source), NULL);
	rb_sync_state_ui_update_volume_usage (&priv->volume_usage, priv->sync_state);

	gtk_widget_show_all (priv->volume_usage.widget);
	container = GTK_CONTAINER (gtk_builder_get_object (builder, "device-usage-container"));
	gtk_container_add (container, priv->volume_usage.widget);


	/* let the subclass fill in device type specific details (model names, device names,
	 * .. battery levels?) and add more tabs to the notebook to display 'advanced' stuff.
	 */

	if (klass->show_properties) {
		klass->show_properties (source,
					     GTK_WIDGET (gtk_builder_get_object (builder, "device-info-box")),
					     GTK_WIDGET (gtk_builder_get_object (builder, "media-player-notebook")));
	}

	/* create sync UI */
	container = GTK_CONTAINER (gtk_builder_get_object (builder, "sync-settings-ui-container"));
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (container), rb_sync_settings_ui_new (source, priv->sync_settings));

	container = GTK_CONTAINER (gtk_builder_get_object (builder, "sync-state-ui-container"));
	gtk_box_pack_start (GTK_BOX (container), rb_sync_state_ui_new (priv->sync_state), TRUE, TRUE, 0);
	gtk_widget_show_all (GTK_WIDGET (container));

	/* create encoding settings UI */
	if (priv->encoding_settings) {
		container = GTK_CONTAINER (gtk_builder_get_object (builder, "encoding-settings-container"));
		gtk_container_add (container, rb_encoding_settings_new (priv->encoding_settings, priv->encoding_target, TRUE));
		gtk_widget_show_all (GTK_WIDGET (container));
	} else {
		container = GTK_CONTAINER (gtk_builder_get_object (builder, "encoding-settings-frame"));
		gtk_widget_hide (GTK_WIDGET (container));
		gtk_widget_set_no_show_all (GTK_WIDGET (container), TRUE);
	}

	gtk_widget_show (GTK_WIDGET (priv->properties_dialog));

	g_object_unref (builder);
}
Пример #15
0
static gboolean gmpc_meta_data_widgets_similar_songs_update_sim_song (GmpcMetaDataWidgetsSimilarSongs* self) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->current == NULL) {
		GList* _tmp0_ = NULL;
		GtkProgressBar* _tmp1_ = NULL;
		_tmp0_ = meta_data_get_text_list (self->priv->copy);
		self->priv->current = _tmp0_;
		_tmp1_ = (GtkProgressBar*) gtk_progress_bar_new ();
		_g_object_unref0 (self->priv->pchild);
		self->priv->pchild = (GtkWidget*) g_object_ref_sink (_tmp1_);
		gtk_container_add ((GtkContainer*) self, self->priv->pchild);
		gtk_widget_show_all ((GtkWidget*) self);
	}
	gtk_progress_bar_pulse (GTK_PROGRESS_BAR (self->priv->pchild));
	if (self->priv->current != NULL) {
		gchar* _tmp2_;
		gchar* entry;
		_tmp2_ = g_strdup ((const gchar*) self->priv->current->data);
		entry = _tmp2_;
		if (entry != NULL) {
			gchar** _tmp3_;
			gchar** _tmp4_ = NULL;
			gchar** split;
			gint split_length1;
			gint _split_size_;
			_tmp4_ = _tmp3_ = g_strsplit (entry, "::", 2);
			split = _tmp4_;
			split_length1 = _vala_array_length (_tmp3_);
			_split_size_ = _vala_array_length (_tmp3_);
			if (split_length1 == 2) {
				gchar** _tmp5_;
				gchar** _tmp6_ = NULL;
				gchar** art_split;
				gint art_split_length1;
				gint _art_split_size_;
				MpdData* _tmp8_ = NULL;
				MpdData* data;
				mpd_database_search_start (connection, FALSE);
				_tmp6_ = _tmp5_ = g_strsplit (split[0], " ", 0);
				art_split = _tmp6_;
				art_split_length1 = _vala_array_length (_tmp5_);
				_art_split_size_ = _vala_array_length (_tmp5_);
				{
					gchar** artist_collection;
					int artist_collection_length1;
					int artist_it;
					artist_collection = art_split;
					artist_collection_length1 = art_split_length1;
					for (artist_it = 0; artist_it < art_split_length1; artist_it = artist_it + 1) {
						gchar* _tmp7_;
						gchar* artist;
						_tmp7_ = g_strdup (artist_collection[artist_it]);
						artist = _tmp7_;
						{
							mpd_database_search_add_constraint (connection, MPD_TAG_ITEM_ARTIST, artist);
							_g_free0 (artist);
						}
					}
				}
				mpd_database_search_add_constraint (connection, MPD_TAG_ITEM_TITLE, split[1]);
				_tmp8_ = mpd_database_search_commit (connection);
				data = _tmp8_;
				if (data != NULL) {
					MpdData* _tmp9_;
					_tmp9_ = data;
					data = NULL;
					self->priv->item = mpd_data_concatenate (self->priv->item, _tmp9_);
				}
				_mpd_data_free0 (data);
				art_split = (_vala_array_free (art_split, art_split_length1, (GDestroyNotify) g_free), NULL);
			}
			split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
		}
		self->priv->current = self->priv->current->next;
		if (self->priv->current != NULL) {
			result = TRUE;
			_g_free0 (entry);
			return result;
		}
		_g_free0 (entry);
	}
	gtk_object_destroy ((GtkObject*) self->priv->pchild);
	if (self->priv->item != NULL) {
		GmpcMpdDataModel* _tmp10_ = NULL;
		GmpcMpdDataModel* model;
		MpdData* _tmp11_;
		GmpcMpdDataTreeview* _tmp12_ = NULL;
		GmpcMpdDataTreeview* tree;
		GtkWidget* _tmp13_;
		_tmp10_ = gmpc_mpddata_model_new ();
		model = _tmp10_;
		self->priv->item = misc_mpddata_remove_duplicate_songs (self->priv->item);
		_tmp11_ = self->priv->item;
		self->priv->item = NULL;
		gmpc_mpddata_model_set_mpd_data (model, _tmp11_);
		_tmp12_ = gmpc_mpddata_treeview_new ("similar-song", TRUE, (GtkTreeModel*) model);
		tree = g_object_ref_sink (_tmp12_);
		gmpc_mpddata_treeview_enable_click_fix (tree);
		g_signal_connect_object ((GtkWidget*) tree, "button-release-event", (GCallback) _gmpc_meta_data_widgets_similar_songs_tree_right_menu_gtk_widget_button_release_event, self, 0);
		g_signal_connect_object ((GtkTreeView*) tree, "row-activated", (GCallback) _gmpc_meta_data_widgets_similar_songs_tree_row_activated_gtk_tree_view_row_activated, self, 0);
		gtk_container_add ((GtkContainer*) self, (GtkWidget*) tree);
		_tmp13_ = _g_object_ref0 ((GtkWidget*) tree);
		_g_object_unref0 (self->priv->pchild);
		self->priv->pchild = _tmp13_;
		_g_object_unref0 (tree);
		_g_object_unref0 (model);
	} else {
		const gchar* _tmp14_ = NULL;
		GtkLabel* _tmp15_ = NULL;
		GtkLabel* label;
		GtkWidget* _tmp16_;
		_tmp14_ = _ ("Unavailable");
		_tmp15_ = (GtkLabel*) gtk_label_new (_tmp14_);
		label = g_object_ref_sink (_tmp15_);
		gtk_misc_set_alignment ((GtkMisc*) label, 0.0f, 0.0f);
		gtk_container_add ((GtkContainer*) self, (GtkWidget*) label);
		_tmp16_ = _g_object_ref0 ((GtkWidget*) label);
		_g_object_unref0 (self->priv->pchild);
		self->priv->pchild = _tmp16_;
		_g_object_unref0 (label);
	}
	_meta_data_free0 (self->priv->copy);
	self->priv->copy = NULL;
	self->priv->idle_add = (guint) 0;
	gtk_widget_show_all ((GtkWidget*) self);
	result = FALSE;
	return result;
}
Пример #16
0
int
main (int argc,
      char *argv[])
{
  GTestDBus *bus;
  GError *error = NULL;
  GOptionContext *context;
  guint sig_term;
  guint sig_int;
  int i;
  gchar *guid = NULL;
  GDBusServer *direct_dbus_server = NULL;

  GOptionEntry entries[] = {
    { NULL }
  };

  signal (SIGPIPE, SIG_IGN);
  /* avoid gvfs (http://bugzilla.gnome.org/show_bug.cgi?id=526454) */
  g_setenv ("GIO_USE_VFS", "local", TRUE);

  g_setenv ("XDG_DATA_HOME", SRCDIR "/src/bridge/mock-resource/home", TRUE);
  g_setenv ("XDG_DATA_DIRS", SRCDIR "/src/bridge/mock-resource/system", TRUE);

  setup_path (argv[0]);

  g_type_init ();

  g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR);

  sig_term = g_unix_signal_add (SIGTERM, on_signal_done, NULL);
  sig_int = g_unix_signal_add (SIGINT, on_signal_done, NULL);

  // System cockpit configuration file should not be loaded
  cockpit_config_file = NULL;

  context = g_option_context_new ("- test dbus json server");
  g_option_context_add_main_entries (context, entries, NULL);
  g_option_context_set_ignore_unknown_options (context, TRUE);
  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      g_printerr ("test-server: %s\n", error->message);
      exit (2);
    }

  /* This isolates us from affecting other processes during tests */
  bus = g_test_dbus_new (G_TEST_DBUS_NONE);
  g_test_dbus_up (bus);
  bus_address = g_test_dbus_get_bus_address (bus);

  guid = g_dbus_generate_guid ();
  direct_dbus_server = g_dbus_server_new_sync ("unix:tmpdir=/tmp/dbus-tests",
                                               G_DBUS_SERVER_FLAGS_NONE,
                                               guid,
                                               NULL,
                                               NULL,
                                               &error);
  if (direct_dbus_server == NULL)
    {
      g_printerr ("test-server: %s\n", error->message);
      exit (3);
    }

  /* Skip the program name */
  argc--;
  argv++;

  /* Null terminate the bridge command line */
  bridge_argv = g_new0 (char *, argc + 2);
  for (i = 0; i < argc; i++)
    bridge_argv[i] = argv[i];
  bridge_argv[i] = "cockpit-bridge";

  loop = g_main_loop_new (NULL, FALSE);

  g_bus_own_name (G_BUS_TYPE_SESSION,
                       "com.redhat.Cockpit.DBusTests.Test",
                       G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE,
                       on_bus_acquired,
                       on_name_acquired,
                       on_name_lost,
                       loop,
                       NULL);

  g_bus_own_name (G_BUS_TYPE_SESSION,
                         "com.redhat.Cockpit.DBusTests.Second",
                         G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE,
                         NULL,
                         on_second_acquired,
                         on_name_lost,
                         loop,
                         NULL);

  g_signal_connect_object (direct_dbus_server,
                           "new-connection",
                           G_CALLBACK (on_new_direct_connection),
                           NULL, 0);
  g_dbus_server_start (direct_dbus_server);
  direct_address = g_dbus_server_get_client_address (direct_dbus_server);

  g_main_loop_run (loop);

  g_source_remove (sig_term);
  g_source_remove (sig_int);

  g_clear_object (&bridge);
  g_clear_object (&exported);
  g_clear_object (&exported_b);
  g_clear_object (&direct_dbus_server);
  g_clear_object (&direct);
  g_clear_object (&direct_b);
  g_main_loop_unref (loop);

  g_test_dbus_down (bus);
  g_object_unref (bus);
  g_free (bridge_argv);
  g_free (guid);

  return exit_code;
}
Пример #17
0
void
gimp_operation_tool_set_operation (GimpOperationTool *tool,
                                   const gchar       *operation,
                                   const gchar       *undo_desc,
                                   const gchar       *icon_name)
{
    GimpImageMapTool *im_tool;

    g_return_if_fail (GIMP_IS_OPERATION_TOOL (tool));
    g_return_if_fail (operation != NULL);

    im_tool = GIMP_IMAGE_MAP_TOOL (tool);

    if (tool->operation)
        g_free (tool->operation);

    if (tool->undo_desc)
        g_free (tool->undo_desc);

    if (tool->icon_name)
        g_free (tool->icon_name);

    tool->operation = g_strdup (operation);
    tool->undo_desc = g_strdup (undo_desc);
    tool->icon_name = g_strdup (icon_name);

    if (tool->config)
        g_object_unref (tool->config);

    tool->config = gimp_gegl_get_config_proxy (tool->operation,
                   GIMP_TYPE_SETTINGS);

    if (tool->aux_input)
    {
        g_object_unref (tool->aux_input);
        tool->aux_input = NULL;
    }

    gimp_image_map_tool_get_operation (im_tool);

    if (undo_desc)
        GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->settings_name = "yes"; /* XXX hack */
    else
        GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->settings_name = NULL; /* XXX hack */

    if (tool->aux_input_box)
    {
        gtk_widget_destroy (tool->aux_input_box);
        tool->aux_input_button = NULL;
        tool->aux_input_box    = NULL;
    }

    if (tool->options_gui)
    {
        gtk_widget_destroy (tool->options_gui);
        tool->options_gui = NULL;

        if (im_tool->active_picker)
        {
            im_tool->active_picker = NULL;
            gimp_color_tool_disable (GIMP_COLOR_TOOL (tool));
        }
    }

    if (gegl_node_has_pad (im_tool->operation, "aux"))
    {
        GimpContext *context;
        GtkWidget   *label;

        tool->aux_input = gegl_node_new_child (NULL,
                                               "operation", "gegl:buffer-source",
                                               NULL);

        gegl_node_connect_to (tool->aux_input,    "output",
                              im_tool->operation, "aux");

        context = GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (tool));

        tool->aux_input_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);

        label = gtk_label_new_with_mnemonic (_("_Aux Input"));
        gtk_box_pack_start (GTK_BOX (tool->aux_input_box), label,
                            FALSE, FALSE, 0);
        gtk_widget_show (label);

        tool->aux_input_button =
            gimp_pickable_button_new (context, GIMP_VIEW_SIZE_LARGE, 1);
        gtk_box_pack_start (GTK_BOX (tool->aux_input_box),
                            tool->aux_input_button, FALSE, FALSE, 0);
        gtk_widget_show (tool->aux_input_button);

        gtk_label_set_mnemonic_widget (GTK_LABEL (label),
                                       tool->aux_input_button);

        if (tool->options_box)
        {
            gtk_box_pack_start (GTK_BOX (tool->options_box), tool->aux_input_box,
                                FALSE, FALSE, 0);
            gtk_widget_show (tool->aux_input_box);
        }

        g_signal_connect_object (tool->aux_input_button, "notify::pickable",
                                 G_CALLBACK (gimp_operation_tool_aux_notify),
                                 tool->aux_input, 0);
    }

    if (tool->config)
    {
        tool->options_gui =
            gimp_prop_gui_new (G_OBJECT (tool->config),
                               G_TYPE_FROM_INSTANCE (tool->config),
                               GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (tool)),
                               (GimpCreatePickerFunc) gimp_image_map_tool_add_color_picker,
                               tool);

        if (tool->options_box)
        {
            gtk_box_pack_start (GTK_BOX (tool->options_box), tool->options_gui,
                                FALSE, FALSE, 0);
            gtk_widget_show (tool->options_gui);
        }
    }

    if (im_tool->gui)
    {
        if (undo_desc)
            gimp_tool_gui_set_description (im_tool->gui, undo_desc);

        if (icon_name)
            gimp_tool_gui_set_icon_name (im_tool->gui, icon_name);
    }

    if (GIMP_TOOL (tool)->drawable)
    {
        gimp_operation_tool_sync_op (tool, GIMP_TOOL (tool)->drawable);
        gimp_image_map_tool_preview (im_tool);
    }
}
Пример #18
0
static void
st_icon_update (StIcon *icon)
{
  StIconPrivate *priv = icon->priv;
  StThemeNode *theme_node;
  StTextureCache *cache;
  gint scale;
  ClutterActor *stage;
  StThemeContext *context;

  if (priv->pending_texture)
    {
      clutter_actor_destroy (priv->pending_texture);
      g_object_unref (priv->pending_texture);
      priv->pending_texture = NULL;
      priv->opacity_handler_id = 0;
    }

  theme_node = st_widget_peek_theme_node (ST_WIDGET (icon));
  if (theme_node == NULL)
    return;

  stage = clutter_actor_get_stage (CLUTTER_ACTOR (icon));
  context = st_theme_context_get_for_stage (CLUTTER_STAGE (stage));
  g_object_get (context, "scale-factor", &scale, NULL);

  cache = st_texture_cache_get_default ();

  if (priv->gicon != NULL)
    priv->pending_texture = st_texture_cache_load_gicon (cache,
                                                         theme_node,
                                                         priv->gicon,
                                                         priv->icon_size,
                                                         scale);

  if (priv->pending_texture == NULL && priv->fallback_gicon != NULL)
    priv->pending_texture = st_texture_cache_load_gicon (cache,
                                                         theme_node,
                                                         priv->fallback_gicon,
                                                         priv->icon_size,
                                                         scale);

  if (priv->pending_texture)
    {
      g_object_ref_sink (priv->pending_texture);

      if (clutter_actor_get_opacity (priv->pending_texture) != 0 || priv->icon_texture == NULL)
        {
          /* This icon is ready for showing, or nothing else is already showing */
          st_icon_finish_update (icon);
        }
      else
        {
          /* Will be shown when fully loaded */
          priv->opacity_handler_id = g_signal_connect_object (priv->pending_texture, "notify::opacity", G_CALLBACK (opacity_changed_cb), icon, 0);
        }
    }
  else if (priv->icon_texture)
    {
      clutter_actor_destroy (priv->icon_texture);
      priv->icon_texture = NULL;
    }
}
Пример #19
0
static GstStateChangeReturn
gst_dtls_enc_change_state (GstElement * element, GstStateChange transition)
{
  GstDtlsEnc *self = GST_DTLS_ENC (element);
  GstStateChangeReturn ret;

  switch (transition) {
    case GST_STATE_CHANGE_NULL_TO_READY:
      if (self->connection_id) {
        self->connection = gst_dtls_dec_fetch_connection (self->connection_id);

        if (!self->connection) {
          GST_WARNING_OBJECT (self,
              "invalid connection id: '%s', connection not found or already in use",
              self->connection_id);
          return GST_STATE_CHANGE_FAILURE;
        }

        g_signal_connect_object (self->connection,
            "on-encoder-key", G_CALLBACK (on_key_received), self, 0);

        gst_dtls_connection_set_send_callback (self->connection,
            g_cclosure_new (G_CALLBACK (on_send_data), self, NULL));
      } else {
        GST_WARNING_OBJECT (self,
            "trying to change state to ready without connection id");
        return GST_STATE_CHANGE_FAILURE;
      }
      break;
    case GST_STATE_CHANGE_PAUSED_TO_READY:
      GST_DEBUG_OBJECT (self, "stopping connection %s", self->connection_id);

      gst_dtls_connection_stop (self->connection);
      break;
    case GST_STATE_CHANGE_READY_TO_NULL:
      GST_DEBUG_OBJECT (self, "closing connection %s", self->connection_id);

      if (self->connection) {
        gst_dtls_connection_close (self->connection);
        gst_dtls_connection_set_send_callback (self->connection, NULL);
        g_object_unref (self->connection);
        self->connection = NULL;
      }
      break;
    default:
      break;
  }

  ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);

  switch (transition) {
    case GST_STATE_CHANGE_READY_TO_PAUSED:
      GST_DEBUG_OBJECT (self, "starting connection %s", self->connection_id);
      gst_dtls_connection_start (self->connection, self->is_client);
      break;
    default:
      break;
  }

  return ret;
}
Пример #20
0
void
plug_in_menus_setup (GimpUIManager *manager,
                     const gchar   *ui_path)
{
  GimpPlugInManager *plug_in_manager;
  GTree             *menu_entries;
  GSList            *list;
  guint              merge_id;
  gint               i;

  g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
  g_return_if_fail (ui_path != NULL);

  plug_in_manager = manager->gimp->plug_in_manager;

  merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));

  for (i = 0; i < manager->gimp->config->plug_in_history_size; i++)
    {
      gchar *action_name;
      gchar *action_path;

      action_name = g_strdup_printf ("plug-in-recent-%02d", i + 1);
      action_path = g_strdup_printf ("%s/Filters/Recently Used/Plug-Ins",
                                     ui_path);

      gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
                             action_path, action_name, action_name,
                             GTK_UI_MANAGER_MENUITEM,
                             FALSE);

      g_free (action_name);
      g_free (action_path);
    }

  menu_entries = g_tree_new_full ((GCompareDataFunc) strcmp, NULL,
                                  g_free,
                                  (GDestroyNotify) plug_in_menu_entry_free);

  for (list = plug_in_manager->plug_in_procedures;
       list;
       list = g_slist_next (list))
    {
      GimpPlugInProcedure *plug_in_proc = list->data;

      if (! plug_in_proc->file)
        continue;

      g_signal_connect_object (plug_in_proc, "menu-path-added",
                               G_CALLBACK (plug_in_menus_menu_path_added),
                               manager, 0);

      if (plug_in_proc->menu_paths &&
          ! plug_in_proc->file_proc)
        {
          GList *path;

          for (path = plug_in_proc->menu_paths; path; path = g_list_next (path))
            {
              if (g_str_has_prefix (path->data, manager->name))
                {
                  PlugInMenuEntry *entry = g_slice_new0 (PlugInMenuEntry);
                  GFile           *file;
                  const gchar     *locale_domain;

                  entry->proc      = plug_in_proc;
                  entry->menu_path = path->data;

                  file = gimp_plug_in_procedure_get_file (plug_in_proc);

                  locale_domain =
                    gimp_plug_in_manager_get_locale_domain (plug_in_manager,
                                                            file, NULL);

                  if (plug_in_proc->menu_label)
                    {
                      gchar *menu;

                      menu = g_strconcat (dgettext (locale_domain,
                                                    path->data),
                                          "/",
                                          dgettext (locale_domain,
                                                    plug_in_proc->menu_label),
                                          NULL);

                      plug_in_menus_tree_insert (menu_entries, menu, entry);
                      g_free (menu);
                    }
                  else
                    {
                      plug_in_menus_tree_insert (menu_entries,
                                                 dgettext (locale_domain,
                                                           path->data),
                                                 entry);
                    }
                }
            }
        }
    }

  g_object_set_data (G_OBJECT (manager), "ui-path", (gpointer) ui_path);

  g_tree_foreach (menu_entries,
                  (GTraverseFunc) plug_in_menus_tree_traverse,
                  manager);

  g_object_set_data (G_OBJECT (manager), "ui-path", NULL);

  g_tree_destroy (menu_entries);

  g_signal_connect_object (manager->gimp->pdb, "register-procedure",
                           G_CALLBACK (plug_in_menus_register_procedure),
                           manager, 0);
  g_signal_connect_object (manager->gimp->pdb, "unregister-procedure",
                           G_CALLBACK (plug_in_menus_unregister_procedure),
                           manager, 0);
}
Пример #21
0
static void
connect_view (GtkSourceMap  *map,
              GtkSourceView *view)
{
	GtkSourceMapPrivate *priv;
	GtkAdjustment *vadj;

	priv = gtk_source_map_get_instance_private (map);

	priv->view = view;
	g_object_add_weak_pointer (G_OBJECT (view), (gpointer *)&priv->view);

	vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (view));

	priv->buffer_binding =
		g_object_bind_property (view, "buffer",
		                        priv->child_view, "buffer",
		                        G_BINDING_SYNC_CREATE);
	g_object_add_weak_pointer (G_OBJECT (priv->buffer_binding),
	                           (gpointer *)&priv->buffer_binding);

	priv->indent_width_binding =
		g_object_bind_property (view, "indent-width",
		                        priv->child_view, "indent-width",
		                        G_BINDING_SYNC_CREATE);
	g_object_add_weak_pointer (G_OBJECT (priv->indent_width_binding),
	                           (gpointer *)&priv->indent_width_binding);

	priv->tab_width_binding =
		g_object_bind_property (view, "tab-width",
		                        priv->child_view, "tab-width",
		                        G_BINDING_SYNC_CREATE);
	g_object_add_weak_pointer (G_OBJECT (priv->tab_width_binding),
	                           (gpointer *)&priv->tab_width_binding);

	priv->view_notify_buffer_handler =
		g_signal_connect_object (view,
		                         "notify::buffer",
		                         G_CALLBACK (view_notify_buffer),
		                         map,
		                         G_CONNECT_SWAPPED);
	view_notify_buffer (map, NULL, view);

	priv->view_vadj_value_changed_handler =
		g_signal_connect_object (vadj,
		                         "value-changed",
		                         G_CALLBACK (view_vadj_value_changed),
		                         map,
		                         G_CONNECT_SWAPPED);

	priv->view_vadj_notify_upper_handler =
		g_signal_connect_object (vadj,
		                         "notify::upper",
		                         G_CALLBACK (view_vadj_notify_upper),
		                         map,
		                         G_CONNECT_SWAPPED);

	if ((gtk_widget_get_events (GTK_WIDGET (priv->view)) & GDK_ENTER_NOTIFY_MASK) == 0)
	{
		gtk_widget_add_events (GTK_WIDGET (priv->view), GDK_ENTER_NOTIFY_MASK);
	}

	if ((gtk_widget_get_events (GTK_WIDGET (priv->view)) & GDK_LEAVE_NOTIFY_MASK) == 0)
	{
		gtk_widget_add_events (GTK_WIDGET (priv->view), GDK_LEAVE_NOTIFY_MASK);
	}

	gtk_source_map_rebuild_css (map);
}
Пример #22
0
void
gimp_dialog_factory_add_dialog (GimpDialogFactory *factory,
                                GtkWidget         *dialog)
{
  GimpDialogFactory      *dialog_factory;
  GimpDialogFactoryEntry *entry;
  GimpSessionInfo        *info;
  GList                  *list;
  gboolean                toplevel;

  g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
  g_return_if_fail (GTK_IS_WIDGET (dialog));

  if (g_list_find (factory->open_dialogs, dialog))
    {
      g_warning ("%s: dialog already registered", G_STRFUNC);
      return;
    }

  dialog_factory = gimp_dialog_factory_from_widget (dialog, &entry);

  if (! (dialog_factory && (entry || GIMP_IS_DOCK (dialog))))
    {
      g_warning ("%s: dialog was not created by a GimpDialogFactory",
                 G_STRFUNC);
      return;
    }

  if (dialog_factory != factory)
    {
      g_warning ("%s: dialog was created by a different GimpDialogFactory",
                 G_STRFUNC);
      return;
    }

  toplevel = GTK_WIDGET_TOPLEVEL (dialog);

  if (entry) /* dialog is a toplevel (but not a GimpDock) or a GimpDockable */
    {
      D (g_print ("%s: adding %s \"%s\"\n",
                  G_STRFUNC,
                  toplevel ? "toplevel" : "dockable",
                  entry->identifier));

      for (list = factory->session_infos; list; list = g_list_next (list))
        {
          info = list->data;

          if ((info->toplevel_entry == entry) ||
              (info->dockable_entry == entry))
            {
              if (info->widget)
                {
                  if (entry->singleton)
                    {
                      g_warning ("%s: singleton dialog \"%s\" created twice",
                                 G_STRFUNC, entry->identifier);

                      D (g_print ("%s: corrupt session info: %p (widget %p)\n",
                                  G_STRFUNC,
                                  info, info->widget));

                      return;
                    }

                  continue;
                }

              info->widget = dialog;

              D (g_print ("%s: updating session info %p (widget %p) for %s \"%s\"\n",
                          G_STRFUNC,
                          info, info->widget,
                          toplevel ? "toplevel" : "dockable",
                          entry->identifier));

              if (toplevel && entry->session_managed)
                gimp_session_info_set_geometry (info);

              break;
            }
        }

      if (! list) /*  didn't find a session info  */
        {
          info = gimp_session_info_new ();

          info->widget = dialog;

          D (g_print  ("%s: creating session info %p (widget %p) for %s \"%s\"\n",
                       G_STRFUNC,
                       info, info->widget,
                       toplevel ? "toplevel" : "dockable",
                       entry->identifier));

          if (toplevel)
            {
              info->toplevel_entry = entry;

              /*  if we create a new session info, we never call
               *  gimp_session_info_set_geometry(), but still the
               *  dialog needs GDK_HINT_USER_POS so it keeps its
               *  position when hidden/shown within this(!) session.
               */
              if (entry->session_managed)
                g_signal_connect (dialog, "configure-event",
                                  G_CALLBACK (gimp_dialog_factory_set_user_pos),
                                  NULL);
            }
          else
            {
              info->dockable_entry = entry;
            }

          factory->session_infos = g_list_append (factory->session_infos, info);
        }
    }
  else /*  dialog is a GimpDock  */
    {
      D (g_print ("%s: adding dock\n", G_STRFUNC));

      for (list = factory->session_infos; list; list = g_list_next (list))
        {
          info = list->data;

          /*  take the first empty slot  */
          if (! info->toplevel_entry &&
              ! info->dockable_entry &&
              ! info->widget)
            {
              info->widget = dialog;

              D (g_print ("%s: updating session info %p (widget %p) for dock\n",
                          G_STRFUNC,
                          info, info->widget));

              gimp_session_info_set_geometry (info);

              break;
            }
        }

      if (! list) /*  didn't find a session info  */
        {
          info = gimp_session_info_new ();

          info->widget = dialog;

          D (g_print ("%s: creating session info %p (widget %p) for dock\n",
                      G_STRFUNC,
                      info, info->widget));

          /*  if we create a new session info, we never call
           *  gimp_session_info_set_geometry(), but still the
           *  dialog needs GDK_HINT_USER_POS so it keeps its
           *  position when hidden/shown within this(!) session.
           */
          g_signal_connect (dialog, "configure-event",
                            G_CALLBACK (gimp_dialog_factory_set_user_pos),
                            NULL);

          factory->session_infos = g_list_append (factory->session_infos, info);
        }
    }

  factory->open_dialogs = g_list_prepend (factory->open_dialogs, dialog);

  g_signal_connect_object (dialog, "destroy",
                           G_CALLBACK (gimp_dialog_factory_remove_dialog),
                           factory,
                           G_CONNECT_SWAPPED);

  if (entry && entry->session_managed && toplevel)
    g_signal_connect_object (dialog, "configure-event",
                             G_CALLBACK (gimp_dialog_factory_dialog_configure),
                             factory,
                             0);
}
Пример #23
0
void
file_actions_setup (GimpActionGroup *group)
{
  GimpEnumActionEntry *entries;
  gint                 n_entries;
  gint                 i;

  gimp_action_group_add_actions (group, "file-action",
                                 file_actions,
                                 G_N_ELEMENTS (file_actions));

  gimp_action_group_add_enum_actions (group, "file-action",
                                      file_save_actions,
                                      G_N_ELEMENTS (file_save_actions),
                                      G_CALLBACK (file_save_cmd_callback));

  n_entries = GIMP_GUI_CONFIG (group->gimp->config)->last_opened_size;

  entries = g_new0 (GimpEnumActionEntry, n_entries);

  for (i = 0; i < n_entries; i++)
    {
      entries[i].name           = g_strdup_printf ("file-open-recent-%02d",
                                                   i + 1);
      entries[i].icon_name      = "document-open";
      entries[i].label          = entries[i].name;
      entries[i].tooltip        = NULL;
      entries[i].value          = i;
      entries[i].value_variable = FALSE;

      if (i < 9)
        entries[i].accelerator = g_strdup_printf ("<primary>%d", i + 1);
      else if (i == 9)
        entries[i].accelerator = g_strdup ("<primary>0");
      else
        entries[i].accelerator = NULL;
    }

  gimp_action_group_add_enum_actions (group, NULL, entries, n_entries,
                                      G_CALLBACK (file_open_recent_cmd_callback));

  for (i = 0; i < n_entries; i++)
    {
      GtkAction *action;

      gimp_action_group_set_action_visible (group, entries[i].name, FALSE);
      gimp_action_group_set_action_always_show_image (group, entries[i].name,
                                                      TRUE);

      action = gtk_action_group_get_action (GTK_ACTION_GROUP (group),
                                            entries[i].name);
      g_object_set (action,
                    "context", gimp_get_user_context (group->gimp),
                    NULL);

      g_free ((gchar *) entries[i].name);
      if (entries[i].accelerator)
        g_free ((gchar *) entries[i].accelerator);
    }

  g_free (entries);

  g_signal_connect_object (group->gimp->documents, "add",
                           G_CALLBACK (file_actions_last_opened_update),
                           group, 0);
  g_signal_connect_object (group->gimp->documents, "remove",
                           G_CALLBACK (file_actions_last_opened_update),
                           group, 0);
  g_signal_connect_object (group->gimp->documents, "reorder",
                           G_CALLBACK (file_actions_last_opened_reorder),
                           group, 0);

  file_actions_last_opened_update (group->gimp->documents, NULL, group);

  /*  also listen to image adding/removal so we catch the case where
   *  the last image is closed but its display stays open.
   */
  g_signal_connect_object (group->gimp->images, "add",
                           G_CALLBACK (file_actions_close_all_update),
                           group, 0);
  g_signal_connect_object (group->gimp->images, "remove",
                           G_CALLBACK (file_actions_close_all_update),
                           group, 0);

  file_actions_close_all_update (group->gimp->displays, NULL, group);
}
Пример #24
0
static ClutterActor *
create_track_info (RBShell *shell)
{
    RBShellPlayer *player;
    RhythmDB *db;
    ClutterActor *box;
    ClutterActor *box2;
    ClutterActor *widget;
    ClutterActor *frame;
    RhythmDBEntry *entry;
    GValue *value;
    guint elapsed;

    g_object_get (shell, "shell-player", &player, "db", &db, NULL);
    entry = rb_shell_player_get_playing_entry (player);

    box = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_HORIZONTAL);
    mx_box_layout_set_spacing (MX_BOX_LAYOUT (box), 16);
    mx_stylable_set_style_class (MX_STYLABLE (box), "TrackInfoBox");
    mx_stylable_set_style (MX_STYLABLE (box), style);

    /* XXX rtl? */

    /* image container */
    frame = mx_frame_new ();
    mx_stylable_set_style_class (MX_STYLABLE (frame), "TrackInfoImage");
    mx_stylable_set_style (MX_STYLABLE (frame), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), frame, 0);
    clutter_container_child_set (CLUTTER_CONTAINER (box), frame,
                                 "expand", FALSE,
                                 NULL);
    set_blank_image (MX_FRAME (frame));
    clutter_actor_show_all (CLUTTER_ACTOR (frame));

    g_signal_connect_object (player, "playing-song-changed", G_CALLBACK (cover_art_entry_changed_cb), frame, 0);
    request_cover_art (MX_FRAME (frame), entry);

    box2 = mx_box_layout_new ();
    mx_box_layout_set_orientation (MX_BOX_LAYOUT (box2), MX_ORIENTATION_VERTICAL);
    mx_box_layout_set_spacing (MX_BOX_LAYOUT (box2), 16);
    mx_stylable_set_style (MX_STYLABLE (box2), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box), box2, 1);
    clutter_container_child_set (CLUTTER_CONTAINER (box), box2,
                                 "expand", TRUE,
                                 "x-fill", TRUE,
                                 "y-fill", TRUE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 NULL);

    /* track info */
    widget = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (widget), "TrackInfoText");
    mx_stylable_set_style (MX_STYLABLE (widget), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box2), widget, 1);
    clutter_container_child_set (CLUTTER_CONTAINER (box2), widget,
                                 "expand", FALSE,
                                 "x-fill", TRUE,
                                 "y-fill", TRUE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 NULL);

    g_signal_connect_object (player, "playing-song-changed", G_CALLBACK (playing_song_changed_cb), widget, 0);
    g_signal_connect_object (db, "entry-changed", G_CALLBACK (entry_changed_cb), widget, 0);
    g_signal_connect_object (db, "entry-extra-metadata-notify::" RHYTHMDB_PROP_STREAM_SONG_TITLE, G_CALLBACK (streaming_title_notify_cb), widget, 0);

    value = rhythmdb_entry_request_extra_metadata (db, entry, RHYTHMDB_PROP_STREAM_SONG_TITLE);
    if (value != NULL) {
        update_track_info (MX_LABEL (widget), db, entry, g_value_get_string (value));
        g_value_unset (value);
        g_free (value);
    } else {
        update_track_info (MX_LABEL (widget), db, entry, NULL);
    }

    /* elapsed/duration */
    widget = mx_label_new ();
    mx_stylable_set_style_class (MX_STYLABLE (widget), "TrackTimeText");
    mx_stylable_set_style (MX_STYLABLE (widget), style);
    mx_box_layout_add_actor (MX_BOX_LAYOUT (box2), widget, 2);
    clutter_container_child_set (CLUTTER_CONTAINER (box2), widget,
                                 "expand", FALSE,
                                 "x-fill", TRUE,
                                 "y-fill", TRUE,
                                 "y-align", MX_ALIGN_MIDDLE,
                                 NULL);

    g_signal_connect_object (player, "elapsed-changed", G_CALLBACK (elapsed_changed_cb), widget, 0);
    if (rb_shell_player_get_playing_time (player, &elapsed, NULL)) {
        update_elapsed (widget, player, elapsed);
    }

    rhythmdb_entry_unref (entry);
    g_object_unref (player);
    g_object_unref (db);
    return box;
}
Пример #25
0
static gboolean
start_next (RBTrackTransferBatch *batch)
{
	char *media_type = NULL;
	char *extension = NULL;

	if (batch->priv->cancelled == TRUE) {
		return FALSE;
	}

	if (batch->priv->entries == NULL) {
		/* guess we must be done.. */
		g_signal_emit (batch, signals[COMPLETE], 0);
		return FALSE;
	}

	batch->priv->current_fraction = 0.0;
	batch->priv->current_encoder = rb_encoder_new ();
	g_signal_connect_object (batch->priv->current_encoder, "progress",
				 G_CALLBACK (encoder_progress_cb),
				 batch, 0);
	g_signal_connect_object (batch->priv->current_encoder, "overwrite",
				 G_CALLBACK (encoder_overwrite_cb),
				 batch, 0);
	g_signal_connect_object (batch->priv->current_encoder, "completed",
				 G_CALLBACK (encoder_completed_cb),
				 batch, 0);

	rb_debug ("%d entries remain in the batch", g_list_length (batch->priv->entries));

	while ((batch->priv->entries != NULL) && (batch->priv->cancelled == FALSE)) {
		RhythmDBEntry *entry;
		guint64 filesize;
		gulong duration;
		double fraction;
		GList *n;

		n = batch->priv->entries;
		batch->priv->entries = g_list_remove_link (batch->priv->entries, n);
		entry = (RhythmDBEntry *)n->data;
		g_list_free_1 (n);

		rb_debug ("attempting to transfer %s", rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));

		/* calculate the fraction of the transfer that this entry represents */
		filesize = rhythmdb_entry_get_uint64 (entry, RHYTHMDB_PROP_FILE_SIZE);
		duration = rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_DURATION);
		if (batch->priv->total_duration > 0) {
			g_assert (duration > 0);	/* otherwise total_duration would be 0 */
			fraction = ((double)duration) / (double) batch->priv->total_duration;
		} else if (batch->priv->total_size > 0) {
			g_assert (filesize > 0);	/* otherwise total_size would be 0 */
			fraction = ((double)filesize) / (double) batch->priv->total_size;
		} else {
			int count = g_list_length (batch->priv->entries) +
				    g_list_length (batch->priv->done_entries) + 1;
			fraction = 1.0 / ((double)count);
		}

		g_free (media_type);
		g_free (extension);
		media_type = NULL;
		extension = NULL;
		if (rb_encoder_get_media_type (batch->priv->current_encoder,
					       entry,
					       batch->priv->media_types,
					       &media_type,
					       &extension) == FALSE) {
			rb_debug ("skipping entry %s, can't find a destination format",
				  rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
			rhythmdb_entry_unref (entry);
			batch->priv->total_fraction += fraction;
			continue;
		}

		g_free (batch->priv->current_dest_uri);
		batch->priv->current_dest_uri = NULL;
		g_signal_emit (batch, signals[GET_DEST_URI], 0,
			       entry,
			       media_type,
			       extension,
			       &batch->priv->current_dest_uri);
		if (batch->priv->current_dest_uri == NULL) {
			rb_debug ("unable to build destination URI for %s, skipping",
				  rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_LOCATION));
			rhythmdb_entry_unref (entry);
			batch->priv->total_fraction += fraction;
			continue;
		}

		batch->priv->current = entry;
		batch->priv->current_entry_fraction = fraction;
		break;
	}

	if (batch->priv->current == NULL) {
		g_object_unref (batch->priv->current_encoder);
		batch->priv->current_encoder = NULL;
	} else {
		g_signal_emit (batch, signals[TRACK_STARTED], 0,
			       batch->priv->current,
			       batch->priv->current_dest_uri);

		rb_encoder_encode (batch->priv->current_encoder,
				   batch->priv->current,
				   batch->priv->current_dest_uri,
				   media_type);
	}
	g_free (media_type);
	g_free (extension);

	return TRUE;
}
Пример #26
0
void
gimp_image_map_tool_get_operation (GimpImageMapTool *im_tool)
{
  GimpImageMapToolClass *klass;
  GimpToolInfo          *tool_info;
  gchar                 *operation_name;

  g_return_if_fail (GIMP_IS_IMAGE_MAP_TOOL (im_tool));

  klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool);

  tool_info = GIMP_TOOL (im_tool)->tool_info;

  if (im_tool->image_map)
    {
      gimp_image_map_abort (im_tool->image_map);
      g_object_unref (im_tool->image_map);
      im_tool->image_map = NULL;
    }

  if (im_tool->operation)
    {
      g_object_unref (im_tool->operation);
      im_tool->operation = NULL;
    }

  if (im_tool->config)
    {
      g_signal_handlers_disconnect_by_func (im_tool->config,
                                            gimp_image_map_tool_config_notify,
                                            im_tool);

      g_object_unref (im_tool->config);
      im_tool->config = NULL;
    }

  if (im_tool->default_config)
    {
      g_object_unref (im_tool->default_config);
      im_tool->default_config = NULL;
    }

  if (im_tool->title)
    {
      g_free (im_tool->title);
      im_tool->title = NULL;
    }

  if (im_tool->description)
    {
      g_free (im_tool->description);
      im_tool->description = NULL;
    }

  if (im_tool->undo_desc)
    {
      g_free (im_tool->undo_desc);
      im_tool->undo_desc = NULL;
    }

  if (im_tool->icon_name)
    {
      g_free (im_tool->icon_name);
      im_tool->icon_name = NULL;
    }

  if (im_tool->help_id)
    {
      g_free (im_tool->help_id);
      im_tool->help_id = NULL;
    }

  operation_name = klass->get_operation (im_tool,
                                         &im_tool->title,
                                         &im_tool->description,
                                         &im_tool->undo_desc,
                                         &im_tool->icon_name,
                                         &im_tool->help_id);

  if (! operation_name)
    operation_name = g_strdup ("gegl:nop");

  if (! im_tool->title)
    im_tool->title = g_strdup (tool_info->blurb);

  if (! im_tool->description)
    im_tool->description = g_strdup (im_tool->title);

  if (! im_tool->undo_desc)
    im_tool->undo_desc = g_strdup (tool_info->blurb);

  if (! im_tool->icon_name)
    im_tool->icon_name =
      g_strdup (gimp_viewable_get_icon_name (GIMP_VIEWABLE (tool_info)));

  if (! im_tool->help_id)
    im_tool->help_id = g_strdup (tool_info->help_id);

  im_tool->operation = gegl_node_new_child (NULL,
                                            "operation", operation_name,
                                            NULL);
  im_tool->config = G_OBJECT (gimp_gegl_config_new (operation_name,
                                                    im_tool->icon_name,
                                                    GIMP_TYPE_SETTINGS));

  gimp_gegl_config_sync_node (GIMP_OBJECT (im_tool->config),
                              im_tool->operation);
  gimp_gegl_config_connect_node (GIMP_OBJECT (im_tool->config),
                                 im_tool->operation);

  if (im_tool->gui)
    {
      gimp_tool_gui_set_title       (im_tool->gui, im_tool->title);
      gimp_tool_gui_set_description (im_tool->gui, im_tool->description);
      gimp_tool_gui_set_icon_name   (im_tool->gui, im_tool->icon_name);
      gimp_tool_gui_set_help_id     (im_tool->gui, im_tool->help_id);
    }

  if (gegl_operation_get_key (operation_name, "position-dependent"))
    {
      if (im_tool->gui)
        gtk_widget_show (im_tool->region_combo);
    }
  else
    {
      if (im_tool->gui)
        gtk_widget_hide (im_tool->region_combo);

      g_object_set (GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (im_tool),
                    "region", GIMP_IMAGE_MAP_REGION_SELECTION,
                    NULL);
    }

  g_free (operation_name);

  g_object_set (GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (im_tool),
                "preview-split",    FALSE,
                "preview-position", 0.5,
                NULL);

  if (im_tool->config)
    g_signal_connect_object (im_tool->config, "notify",
                             G_CALLBACK (gimp_image_map_tool_config_notify),
                             G_OBJECT (im_tool), 0);

  if (GIMP_TOOL (im_tool)->drawable)
    gimp_image_map_tool_create_map (im_tool);
}
Пример #27
0
void
documents_clear_cmd_callback (GtkAction *action,
                              gpointer   data)
{
  GimpContainerEditor *editor  = GIMP_CONTAINER_EDITOR (data);
  GimpContext         *context = gimp_container_view_get_context (editor->view);
  Gimp                *gimp    = context->gimp;
  GtkWidget           *dialog;

  dialog = gimp_message_dialog_new (_("Clear Document History"),
                                    GTK_STOCK_CLEAR,
                                    GTK_WIDGET (editor),
                                    GTK_DIALOG_MODAL |
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    gimp_standard_help_func, NULL,

                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                    GTK_STOCK_CLEAR,  GTK_RESPONSE_OK,

                                    NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  g_signal_connect_object (gtk_widget_get_toplevel (GTK_WIDGET (editor)),
                           "unmap",
                           G_CALLBACK (gtk_widget_destroy),
                           dialog, G_CONNECT_SWAPPED);

  gimp_message_box_set_primary_text (GIMP_MESSAGE_DIALOG (dialog)->box,
                                     _("Clear the Recent Documents list?"));

  gimp_message_box_set_text (GIMP_MESSAGE_DIALOG (dialog)->box,
                             _("Clearing the document history will "
                               "permanently remove all images from "
                               "the recent documents list."));

  if (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK)
    {
      GtkRecentManager *manager = gtk_recent_manager_get_default ();
      GList            *items;
      GList            *list;

      items = gtk_recent_manager_get_items (manager);

      for (list = items; list; list = list->next)
        {
          GtkRecentInfo *info = list->data;

          if (gtk_recent_info_has_application (info,
                                               "GNU Image Manipulation Program"))
            {
              gtk_recent_manager_remove_item (manager,
                                              gtk_recent_info_get_uri (info),
                                              NULL);
            }

          gtk_recent_info_unref (info);
        }

      g_list_free (items);

      gimp_container_clear (gimp->documents);
    }

  gtk_widget_destroy (dialog);
}
Пример #28
0
static gboolean
gimp_image_map_tool_initialize (GimpTool     *tool,
                                GimpDisplay  *display,
                                GError      **error)
{
  GimpImageMapTool *im_tool   = GIMP_IMAGE_MAP_TOOL (tool);
  GimpToolInfo     *tool_info = tool->tool_info;
  GimpImage        *image     = gimp_display_get_image (display);
  GimpDrawable     *drawable  = gimp_image_get_active_drawable (image);
  GimpDisplayShell *shell     = gimp_display_get_shell (display);

  if (! drawable)
    return FALSE;

  if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
    {
      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
			   _("Cannot modify the pixels of layer groups."));
      return FALSE;
    }

  if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
    {
      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
			   _("The active layer's pixels are locked."));
      return FALSE;
    }

  if (! gimp_item_is_visible (GIMP_ITEM (drawable)))
    {
      g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED,
                           _("The active layer is not visible."));
      return FALSE;
    }

  if (im_tool->active_picker)
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (im_tool->active_picker),
                                  FALSE);

  /*  set display so the dialog can be hidden on display destruction  */
  tool->display = display;

  if (im_tool->config)
    gimp_config_reset (GIMP_CONFIG (im_tool->config));

  if (! im_tool->gui)
    {
      GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (im_tool);
      GtkWidget             *vbox;
      GtkWidget             *hbox;
      GtkWidget             *toggle;
      gchar                 *operation_name;

      /*  disabled for at least GIMP 2.8  */
      im_tool->overlay = FALSE;

      im_tool->gui =
        gimp_tool_gui_new (tool_info,
                           im_tool->title,
                           im_tool->description,
                           im_tool->icon_name,
                           im_tool->help_id,
                           gtk_widget_get_screen (GTK_WIDGET (shell)),
                           gimp_widget_get_monitor (GTK_WIDGET (shell)),
                           im_tool->overlay,

                           GIMP_STOCK_RESET, RESPONSE_RESET,
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                           GTK_STOCK_OK,     GTK_RESPONSE_OK,

                           NULL);

      gimp_tool_gui_set_default_response (im_tool->gui, GTK_RESPONSE_OK);

      gimp_tool_gui_set_alternative_button_order (im_tool->gui,
                                                  RESPONSE_RESET,
                                                  GTK_RESPONSE_OK,
                                                  GTK_RESPONSE_CANCEL,
                                                  -1);

      vbox = gimp_tool_gui_get_vbox (im_tool->gui);

      g_signal_connect_object (im_tool->gui, "response",
                               G_CALLBACK (gimp_image_map_tool_response),
                               G_OBJECT (im_tool), 0);

      if (im_tool->config && klass->settings_name)
        {
          GType          type = G_TYPE_FROM_INSTANCE (im_tool->config);
          GimpContainer *settings;
          GFile         *settings_file;
          GFile         *default_folder;
          GtkWidget     *settings_ui;

          settings = gimp_gegl_config_get_container (type);
          if (! gimp_list_get_sort_func (GIMP_LIST (settings)))
            gimp_list_set_sort_func (GIMP_LIST (settings),
                                     (GCompareFunc) gimp_settings_compare);

          settings_file = gimp_tool_info_get_options_file (tool_info,
                                                           ".settings");
          default_folder = gimp_directory_file (klass->settings_name, NULL);

          settings_ui = klass->get_settings_ui (im_tool,
                                                settings,
                                                settings_file,
                                                klass->import_dialog_title,
                                                klass->export_dialog_title,
                                                im_tool->help_id,
                                                default_folder,
                                                &im_tool->settings_box);

          g_object_unref (default_folder);
          g_object_unref (settings_file);

          gtk_box_pack_start (GTK_BOX (vbox), settings_ui, FALSE, FALSE, 0);
          gtk_widget_show (settings_ui);
        }

      /*  The gamma hack toggle  */
      toggle = gtk_check_button_new_with_label ("Gamma hack (temp hack, please ignore)");
      gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
      gtk_widget_show (toggle);

      g_signal_connect (toggle, "toggled",
                        G_CALLBACK (gamma_hack),
                        im_tool);

      /*  The preview and split view toggles  */
      hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
      gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
      gtk_widget_show (hbox);

      toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
                                           "preview", NULL);
      gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
      gtk_widget_show (toggle);

      toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
                                           "preview-split", NULL);
      gtk_box_pack_start (GTK_BOX (hbox), toggle, FALSE, FALSE, 0);
      gtk_widget_show (toggle);

      g_object_bind_property (G_OBJECT (tool_info->tool_options), "preview",
                              toggle,                             "sensitive",
                              G_BINDING_SYNC_CREATE);

      /*  The area combo  */
      gegl_node_get (im_tool->operation,
                     "operation", &operation_name,
                     NULL);

      im_tool->region_combo =
        gimp_prop_enum_combo_box_new (G_OBJECT (tool_info->tool_options),
                                      "region",
                                      0, 0);
      gtk_box_pack_end (GTK_BOX (vbox), im_tool->region_combo,
                        FALSE, FALSE, 0);

      if (operation_name &&
          gegl_operation_get_key (operation_name, "position-dependent"))
        {
          gtk_widget_show (im_tool->region_combo);
        }

      g_free (operation_name);

      /*  Fill in subclass widgets  */
      gimp_image_map_tool_dialog (im_tool);
    }
  else
    {
      gimp_tool_gui_set_title (im_tool->gui, im_tool->title);
      gimp_tool_gui_set_description (im_tool->gui, im_tool->description);
      gimp_tool_gui_set_icon_name (im_tool->gui, im_tool->icon_name);
      gimp_tool_gui_set_help_id (im_tool->gui, im_tool->help_id);
    }

  gimp_tool_gui_set_shell (im_tool->gui, shell);
  gimp_tool_gui_set_viewable (im_tool->gui, GIMP_VIEWABLE (drawable));

  gimp_tool_gui_show (im_tool->gui);

  im_tool->drawable = drawable;
  gimp_image_map_tool_create_map (im_tool);

  gimp_image_map_tool_preview (im_tool);

  return TRUE;
}
Пример #29
0
RygelGeneralPrefSection* rygel_general_pref_section_construct (GType object_type, GtkBuilder* builder, RygelUserConfig* config, GError** error) {
#line 157 "rygel-general-pref-section.c"
	GError * _inner_error_;
	RygelGeneralPrefSection * self;
	GtkCheckButton* _tmp0_;
	GtkComboBoxEntry* _tmp1_;
	GtkSpinButton* _tmp2_;
	GtkCheckButton* _tmp3_;
	GtkCheckButton* _tmp4_;
	GtkCheckButton* _tmp5_;
	GtkCheckButton* _tmp6_;
	GUPnPContextManager* _tmp7_;
#line 47 "rygel-general-pref-section.vala"
	g_return_val_if_fail (builder != NULL, NULL);
#line 47 "rygel-general-pref-section.vala"
	g_return_val_if_fail (config != NULL, NULL);
#line 172 "rygel-general-pref-section.c"
	_inner_error_ = NULL;
#line 49 "rygel-general-pref-section.vala"
	self = (RygelGeneralPrefSection*) rygel_preferences_section_construct (object_type, config, "general");
#line 51 "rygel-general-pref-section.vala"
	self->priv->upnp_check = (_tmp0_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_UPNP_CHECKBUTTON))), _g_object_unref0 (self->priv->upnp_check), _tmp0_);
#line 52 "rygel-general-pref-section.vala"
	g_assert (self->priv->upnp_check != NULL);
#line 53 "rygel-general-pref-section.vala"
	self->priv->iface_entry = (_tmp1_ = _g_object_ref0 (GTK_COMBO_BOX_ENTRY (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_IFACE_ENTRY))), _g_object_unref0 (self->priv->iface_entry), _tmp1_);
#line 54 "rygel-general-pref-section.vala"
	g_assert (self->priv->iface_entry != NULL);
#line 55 "rygel-general-pref-section.vala"
	self->priv->port_spin = (_tmp2_ = _g_object_ref0 (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_PORT_SPINBUTTON))), _g_object_unref0 (self->priv->port_spin), _tmp2_);
#line 56 "rygel-general-pref-section.vala"
	g_assert (self->priv->port_spin != NULL);
#line 57 "rygel-general-pref-section.vala"
	self->priv->trans_check = (_tmp3_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_TRANS_CHECKBUTTON))), _g_object_unref0 (self->priv->trans_check), _tmp3_);
#line 58 "rygel-general-pref-section.vala"
	g_assert (self->priv->trans_check != NULL);
#line 59 "rygel-general-pref-section.vala"
	self->priv->mp3_check = (_tmp4_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_MP3_CHECKBUTTON))), _g_object_unref0 (self->priv->mp3_check), _tmp4_);
#line 60 "rygel-general-pref-section.vala"
	g_assert (self->priv->mp3_check != NULL);
#line 61 "rygel-general-pref-section.vala"
	self->priv->mp2ts_check = (_tmp5_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_MP2TS_CHECKBUTTON))), _g_object_unref0 (self->priv->mp2ts_check), _tmp5_);
#line 62 "rygel-general-pref-section.vala"
	g_assert (self->priv->mp2ts_check != NULL);
#line 63 "rygel-general-pref-section.vala"
	self->priv->lpcm_check = (_tmp6_ = _g_object_ref0 (GTK_CHECK_BUTTON (gtk_builder_get_object (builder, RYGEL_GENERAL_PREF_SECTION_LPCM_CHECKBUTTON))), _g_object_unref0 (self->priv->lpcm_check), _tmp6_);
#line 64 "rygel-general-pref-section.vala"
	g_assert (self->priv->lpcm_check != NULL);
#line 66 "rygel-general-pref-section.vala"
	self->priv->context_manager = (_tmp7_ = gupnp_context_manager_new (NULL, (guint) 0), _g_object_unref0 (self->priv->context_manager), _tmp7_);
#line 69 "rygel-general-pref-section.vala"
	gtk_combo_box_entry_set_text_column (self->priv->iface_entry, 0);
#line 208 "rygel-general-pref-section.c"
	{
		char* _tmp8_;
		char* _tmp9_;
#line 71 "rygel-general-pref-section.vala"
		_tmp8_ = rygel_configuration_get_interface ((RygelConfiguration*) config, &_inner_error_);
#line 214 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch1_g_error;
		}
#line 71 "rygel-general-pref-section.vala"
		gtk_combo_box_append_text ((GtkComboBox*) self->priv->iface_entry, _tmp9_ = _tmp8_);
#line 220 "rygel-general-pref-section.c"
		_g_free0 (_tmp9_);
#line 72 "rygel-general-pref-section.vala"
		gtk_combo_box_set_active ((GtkComboBox*) self->priv->iface_entry, 0);
#line 224 "rygel-general-pref-section.c"
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally1:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gint _tmp10_;
#line 78 "rygel-general-pref-section.vala"
		_tmp10_ = rygel_configuration_get_port ((RygelConfiguration*) config, &_inner_error_);
#line 246 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch2_g_error;
		}
#line 78 "rygel-general-pref-section.vala"
		gtk_spin_button_set_value (self->priv->port_spin, (double) _tmp10_);
#line 252 "rygel-general-pref-section.c"
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally2:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp11_;
#line 81 "rygel-general-pref-section.vala"
		_tmp11_ = rygel_configuration_get_upnp_enabled ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 274 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch3_g_error;
		}
#line 81 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->upnp_check, _tmp11_);
#line 280 "rygel-general-pref-section.c"
	}
	goto __finally3;
	__catch3_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally3:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp12_;
#line 84 "rygel-general-pref-section.vala"
		_tmp12_ = rygel_configuration_get_transcoding ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 302 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch4_g_error;
		}
#line 84 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->trans_check, _tmp12_);
#line 308 "rygel-general-pref-section.c"
	}
	goto __finally4;
	__catch4_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally4:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp13_;
#line 87 "rygel-general-pref-section.vala"
		_tmp13_ = rygel_configuration_get_mp3_transcoder ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 330 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch5_g_error;
		}
#line 87 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->mp3_check, _tmp13_);
#line 336 "rygel-general-pref-section.c"
	}
	goto __finally5;
	__catch5_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally5:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp14_;
#line 90 "rygel-general-pref-section.vala"
		_tmp14_ = rygel_configuration_get_mp2ts_transcoder ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 358 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch6_g_error;
		}
#line 90 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->mp2ts_check, _tmp14_);
#line 364 "rygel-general-pref-section.c"
	}
	goto __finally6;
	__catch6_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally6:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
	{
		gboolean _tmp15_;
#line 93 "rygel-general-pref-section.vala"
		_tmp15_ = rygel_configuration_get_lpcm_transcoder ((RygelConfiguration*) ((RygelPreferencesSection*) self)->config, &_inner_error_);
#line 386 "rygel-general-pref-section.c"
		if (_inner_error_ != NULL) {
			goto __catch7_g_error;
		}
#line 93 "rygel-general-pref-section.vala"
		gtk_toggle_button_set_active ((GtkToggleButton*) self->priv->lpcm_check, _tmp15_);
#line 392 "rygel-general-pref-section.c"
	}
	goto __finally7;
	__catch7_g_error:
	{
		GError * err;
		err = _inner_error_;
		_inner_error_ = NULL;
		{
			_g_error_free0 (err);
		}
	}
	__finally7:
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		g_object_unref (self);
		return NULL;
	}
#line 96 "rygel-general-pref-section.vala"
	g_signal_connect_object ((GtkToggleButton*) self->priv->trans_check, "toggled", (GCallback) _rygel_general_pref_section_on_trans_check_toggled_gtk_toggle_button_toggled, self, 0);
#line 98 "rygel-general-pref-section.vala"
	g_signal_connect_object (self->priv->context_manager, "context-available", (GCallback) _rygel_general_pref_section_on_context_available_gupnp_context_manager_context_available, self, 0);
#line 100 "rygel-general-pref-section.vala"
	g_signal_connect_object (self->priv->context_manager, "context-unavailable", (GCallback) _rygel_general_pref_section_on_context_unavailable_gupnp_context_manager_context_unavailable, self, 0);
#line 104 "rygel-general-pref-section.vala"
	rygel_general_pref_section_on_trans_check_toggled (self, self->priv->trans_check);
#line 418 "rygel-general-pref-section.c"
	return self;
}
void metadata_menuitem_fetch_art (MetadataMenuitem* self, const gchar* uri, const gchar* prop) {
	const gchar* _tmp0_;
	GFile* _tmp1_ = NULL;
	GFile* art_file;
	GFile* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	FetchFile* _tmp23_;
	FetchFile* _tmp24_;
	FetchFile* _tmp25_;
	FetchFile* _tmp26_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (uri != NULL);
	g_return_if_fail (prop != NULL);
	_tmp0_ = uri;
	_tmp1_ = g_file_new_for_uri (_tmp0_);
	art_file = _tmp1_;
	_tmp2_ = art_file;
	_tmp3_ = g_file_is_native (_tmp2_);
	if (_tmp3_ == TRUE) {
		GFile* _tmp4_;
		gboolean _tmp5_ = FALSE;
		gchar* path = NULL;
		_tmp4_ = art_file;
		_tmp5_ = g_file_query_exists (_tmp4_, NULL);
		if (_tmp5_ == FALSE) {
			const gchar* _tmp6_;
			_tmp6_ = prop;
			dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, _tmp6_, PLAYER_ITEM_EMPTY);
			_g_object_unref0 (art_file);
			return;
		}
		{
			const gchar* _tmp7_;
			gchar* _tmp8_ = NULL;
			gchar* _tmp9_;
			gchar* _tmp10_ = NULL;
			gchar* _tmp11_;
			gchar* _tmp12_;
			const gchar* _tmp13_;
			gchar* _tmp14_ = NULL;
			gchar* _tmp15_;
			const gchar* _tmp16_;
			const gchar* _tmp17_;
			_tmp7_ = uri;
			_tmp8_ = string_strip (_tmp7_);
			_tmp9_ = _tmp8_;
			_tmp10_ = g_filename_from_uri (_tmp9_, NULL, &_inner_error_);
			_tmp11_ = _tmp10_;
			_g_free0 (_tmp9_);
			_tmp12_ = _tmp11_;
			if (_inner_error_ != NULL) {
				if (_inner_error_->domain == G_CONVERT_ERROR) {
					goto __catch5_g_convert_error;
				}
				_g_free0 (path);
				_g_object_unref0 (art_file);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
			_g_free0 (path);
			path = _tmp12_;
			_tmp13_ = uri;
			_tmp14_ = string_strip (_tmp13_);
			_tmp15_ = _tmp14_;
			g_debug ("metadata-menu-item.vala:116: Populating the artwork field with %s", _tmp15_);
			_g_free0 (_tmp15_);
			_tmp16_ = prop;
			_tmp17_ = path;
			dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) self, _tmp16_, _tmp17_);
		}
		goto __finally5;
		__catch5_g_convert_error:
		{
			GError* e = NULL;
			const gchar* _tmp18_;
			e = _inner_error_;
			_inner_error_ = NULL;
			_tmp18_ = uri;
			g_warning ("metadata-menu-item.vala:120: Problem converting URI %s to file path", _tmp18_);
			_g_error_free0 (e);
		}
		__finally5:
		if (_inner_error_ != NULL) {
			_g_free0 (path);
			_g_object_unref0 (art_file);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_g_free0 (path);
		_g_object_unref0 (art_file);
		return;
	}
	_tmp19_ = metadata_menuitem_album_art_cache_dir;
	g_debug ("metadata-menu-item.vala:126: fetch_art -remotely %s", _tmp19_);
	_tmp20_ = metadata_menuitem_album_art_cache_dir;
	if (_tmp20_ == NULL) {
		_g_object_unref0 (art_file);
		return;
	}
	_tmp21_ = uri;
	_tmp22_ = prop;
	_tmp23_ = fetch_file_new (_tmp21_, _tmp22_);
	_g_object_unref0 (metadata_menuitem_fetcher);
	metadata_menuitem_fetcher = _tmp23_;
	_tmp24_ = metadata_menuitem_fetcher;
	g_signal_connect_object (_tmp24_, "failed", (GCallback) ___lambda2__fetch_file_failed, self, 0);
	_tmp25_ = metadata_menuitem_fetcher;
	g_signal_connect_object (_tmp25_, "completed", (GCallback) _metadata_menuitem_on_fetcher_completed_fetch_file_completed, self, 0);
	_tmp26_ = metadata_menuitem_fetcher;
	fetch_file_fetch_data (_tmp26_, NULL, NULL);
	_g_object_unref0 (art_file);
}