Exemplo n.º 1
0
Arquivo: assistant.c Projeto: BYC/gtk
static void
create_page1 (GtkWidget *assistant)
{
  GtkWidget *box, *label, *entry;
  GdkPixbuf *pixbuf;

  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
  gtk_container_set_border_width (GTK_CONTAINER (box), 12);

  label = gtk_label_new ("You must fill out this entry to continue:");
  gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);

  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0);
  g_signal_connect (G_OBJECT (entry), "changed",
		    G_CALLBACK (on_entry_changed), assistant);

  gtk_widget_show_all (box);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 1");
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), box, GTK_ASSISTANT_PAGE_INTRO);

  pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
  gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
  g_object_unref (pixbuf);
}
Exemplo n.º 2
0
static void
dialog_pref_add_item (PrefState *state, char const *page_name,
		      char const *icon_name,
		      int page, char const* parent_path)
{
	GtkTreeIter iter, parent;
	GdkPixbuf * icon = NULL;

	if (icon_name != NULL)
		icon = gtk_widget_render_icon_pixbuf (state->dialog, icon_name,
					       GTK_ICON_SIZE_MENU);
	if ((parent_path != NULL) && gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (state->store),
									  &parent, parent_path))
		gtk_tree_store_append (state->store, &iter, &parent);
	else
		gtk_tree_store_append (state->store, &iter, NULL);

	gtk_tree_store_set (state->store, &iter,
			    ITEM_ICON, icon,
			    ITEM_NAME, _(page_name),
			    PAGE_NUMBER, page,
			    -1);
	if (icon != NULL)
		g_object_unref (icon);
}
Exemplo n.º 3
0
/**
 * gtk_clutter_texture_set_from_stock:
 * @texture: a #GtkClutterTexture
 * @widget: a #GtkWidget
 * @stock_id: the stock id of the icon
 * @icon_size: the size of the icon, or -1
 * @error: a return location for errors, or %NULL
 *
 * Sets the contents of @texture using the stock icon @stock_id, as
 * rendered by @widget.
 *
 * Return value: %TRUE on success, %FALSE on failure.
 */
gboolean
gtk_clutter_texture_set_from_stock (GtkClutterTexture  *texture,
                                    GtkWidget          *widget,
                                    const gchar        *stock_id,
                                    GtkIconSize         icon_size,
                                    GError            **error)
{
  GdkPixbuf *pixbuf;
  gboolean returnval;

  g_return_val_if_fail (GTK_CLUTTER_IS_TEXTURE (texture), FALSE);
  g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
  g_return_val_if_fail (stock_id != NULL, FALSE);
  g_return_val_if_fail ((icon_size > GTK_ICON_SIZE_INVALID) || (icon_size == -1), FALSE);

  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, icon_size);
  G_GNUC_END_IGNORE_DEPRECATIONS

  if (pixbuf == NULL)
    {
      g_set_error (error,
                   GTK_CLUTTER_TEXTURE_ERROR,
                   GTK_CLUTTER_TEXTURE_ERROR_INVALID_STOCK_ID,
                   _("Stock ID '%s' not found"),
                   stock_id);
      return FALSE;
    }

  returnval = gtk_clutter_texture_set_from_pixbuf (texture, pixbuf, error);
  g_object_unref (pixbuf);

  return returnval;
}
Exemplo n.º 4
0
static void
gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle,
                                         GtkWidget              *widget)
{
  if (toggle->pixbuf)
    g_object_unref (toggle->pixbuf);

  toggle->pixbuf = gtk_widget_render_icon_pixbuf (widget,
                                                  toggle->stock_id,
                                                  toggle->stock_size);
}
/*
 * Main entry point for the Cell Sort dialog box
 */
void
dialog_cell_sort (WBCGtk *wbcg)
{
	SortFlowState *state;
	GtkBuilder *gui;

	g_return_if_fail (wbcg != NULL);

	if (gnumeric_dialog_raise_if_exists (wbcg, CELL_SORT_KEY))
		return;

	gui = gnm_gtk_builder_new ("cell-sort.ui", NULL, GO_CMD_CONTEXT (wbcg));
    if (gui == NULL)
            return;

	state = g_new (SortFlowState, 1);
	state->wbcg  = wbcg;
	state->wb    = wb_control_get_workbook (WORKBOOK_CONTROL (wbcg));
	state->sv    = wb_control_cur_sheet_view (WORKBOOK_CONTROL (wbcg));
	state->sheet = sv_sheet (state->sv);
	state->warning_dialog = NULL;
	state->sel = NULL;
	state->sort_items = 0;
	state->gui = gui;
        state->dialog = go_gtk_builder_get_widget (state->gui, "CellSort");

	state->image_ascending =
		gtk_widget_render_icon_pixbuf (state->dialog,
					GTK_STOCK_SORT_ASCENDING,
					GTK_ICON_SIZE_LARGE_TOOLBAR);
	state->image_descending =
		gtk_widget_render_icon_pixbuf (state->dialog,
					GTK_STOCK_SORT_DESCENDING,
					GTK_ICON_SIZE_LARGE_TOOLBAR);
	dialog_init (state);

	gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
			       CELL_SORT_KEY);

	gtk_widget_show (state->dialog);
}
Exemplo n.º 6
0
static void create_pixbufs(void)
{
	GtkTextDirection dir =
	    gtk_widget_get_direction(GTK_WIDGET(widgets.app));

	bm_pixbufs = g_new0(BookMarksPixbufs, 1);

	if (dir == GTK_TEXT_DIR_LTR) {
		/* leave this for if we make custom reversable icons
		   if (!bm_pixbufs->pixbuf_closed)
		   bm_pixbufs->pixbuf_closed =
		   pixbuf_finder("book_closed.png", 16, NULL);
		 */

		bm_pixbufs->pixbuf_opened =
		    pixbuf_finder("book_open.png", 16, NULL);
	} else {
		/* leave this for if we make custom reversable icons
		   if (!bm_pixbufs->pixbuf_closed)
		   bm_pixbufs->pixbuf_closed =
		   pixbuf_finder("book_closed_rtol.png", 16, NULL);
		 */

		bm_pixbufs->pixbuf_opened =
		    pixbuf_finder("book_open_rtol.png", 16, NULL);
	}

	bm_pixbufs->pixbuf_closed =
	    pixbuf_finder("epiphany-bookmarks.png", 0, NULL);

	bm_pixbufs->pixbuf_helpdoc =
	    pixbuf_finder("epiphany-bookmark-page.png", 0, NULL);

	if (!bm_pixbufs->pixbuf_helpdoc)
#ifdef USE_GTK_3
		bm_pixbufs->pixbuf_helpdoc =
#ifdef HAVE_GTK_310
		    GDK_PIXBUF(gtk_image_new_from_icon_name("gtk-dnd",
							    GTK_ICON_SIZE_BUTTON));
#else
		    gtk_widget_render_icon_pixbuf(widgets.app,
						  GTK_STOCK_DND,
						  GTK_ICON_SIZE_MENU);
#endif

#else
		bm_pixbufs->pixbuf_helpdoc = gtk_widget_render_icon(widgets.app,
								    GTK_STOCK_DND,
								    GTK_ICON_SIZE_MENU, NULL);
#endif
}
Exemplo n.º 7
0
Arquivo: assistant.c Projeto: BYC/gtk
static void
create_page3 (GtkWidget *assistant)
{
  GtkWidget *label;
  GdkPixbuf *pixbuf;

  label = gtk_label_new ("This is a confirmation page, press 'Apply' to apply changes");

  gtk_widget_show (label);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), label);
  gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label, GTK_ASSISTANT_PAGE_CONFIRM);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label, "Confirmation");

  pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
  gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), label, pixbuf);
  g_object_unref (pixbuf);
}
Exemplo n.º 8
0
void
_gcr_display_view_set_stock_image (GcrDisplayView *self, GcrRenderer *renderer,
                                   const gchar *stock_id)
{
	GcrDisplayItem *item;

	g_return_if_fail (GCR_IS_DISPLAY_VIEW (self));
	item = lookup_display_item (self, renderer);
	g_return_if_fail (item);

	if (item->pixbuf)
		g_object_unref (item->pixbuf);
	if (stock_id)
#if GTK_CHECK_VERSION (2,91,7)
		item->pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (self), stock_id, GTK_ICON_SIZE_DIALOG);
#else
		item->pixbuf = gtk_widget_render_icon (GTK_WIDGET (self), stock_id, GTK_ICON_SIZE_DIALOG, NULL);
#endif
	else
Exemplo n.º 9
0
static GdkPixbuf *
make_icon (GtkAction *a, const char *stock_id, GtkWidget *tool)
{
	GtkIconSize size;
	GdkPixbuf *res;

	if (stock_id == NULL)
		return NULL;

	size = GTK_IS_TOOL_ITEM (tool)
		? gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (tool))
		: GTK_ICON_SIZE_MENU;

	/* This should go away when we assume icon names.  */
	res = gtk_widget_render_icon_pixbuf (tool, stock_id, size);
	if (res)
		return res;

	return go_gtk_widget_render_icon_pixbuf (tool, stock_id, size);
}
Exemplo n.º 10
0
static void ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e) {
    GdkPixbuf *pixbuf;
    GdkPixbuf *scaled;

    ExternalPlayerPlugin* plugin = EXTERNAL_PLAYER_PLUGIN(ipref);
    plugin->prefs = init_external_player_preferences();
    if (plugin->prefs == NULL)
        return;

    pixbuf = gtk_widget_render_icon_pixbuf(plugin->prefs, GTK_STOCK_MEDIA_PLAY, GTK_ICON_SIZE_LARGE_TOOLBAR);
    if (!pixbuf) {
        g_warning (N_("Couldn't load theme media player icon"));
    }

    scaled = gdk_pixbuf_scale_simple(pixbuf, 48, 48, GDK_INTERP_BILINEAR);

    anjuta_preferences_dialog_add_page(ANJUTA_PREFERENCES_DIALOG (anjuta_preferences_get_dialog (prefs)), "gtkpod-external-player-settings", TAB_NAME, scaled, plugin->prefs);
    g_object_unref(scaled);
    g_object_unref(pixbuf);
}
Exemplo n.º 11
0
Arquivo: assistant.c Projeto: BYC/gtk
static void
create_page2 (GtkWidget *assistant)
{
  GtkWidget *box, *checkbutton;
  GdkPixbuf *pixbuf;

  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
  gtk_container_set_border_width (GTK_CONTAINER (box), 12);

  checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
						 "even if you do not check this");
  gtk_box_pack_start (GTK_BOX (box), checkbutton, FALSE, FALSE, 0);

  gtk_widget_show_all (box);
  gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);
  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);
  gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 2");

  pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
  gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
  g_object_unref (pixbuf);
}
Exemplo n.º 12
0
static void
statusicon_on_notification_added (boost::shared_ptr<Ekiga::Notification> notification,
                                  gpointer data)
{
  StatusIcon *self = STATUSICON (data);
  GdkPixbuf* pixbuf = gtk_widget_render_icon_pixbuf (self->priv->chat_window,
						     GTK_STOCK_DIALOG_WARNING,
						     GTK_ICON_SIZE_MENU);

  gchar *current_tooltip = gtk_status_icon_get_tooltip_text (GTK_STATUS_ICON (self));
  gchar *tooltip = NULL;
  if (current_tooltip != NULL)
    tooltip = g_strdup_printf ("%s\n%s", current_tooltip, notification->get_title ().c_str ());
  else
    tooltip = g_strdup (notification->get_title ().c_str ());

  gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), pixbuf);
  gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), tooltip);
  g_object_unref (pixbuf);

  g_free (current_tooltip);
  g_free (tooltip);
}
Exemplo n.º 13
0
static void
from_stock (GtkSourcePixbufHelper *helper,
            GtkWidget             *widget,
            gint                   size)
{
	GtkIconSize icon_size;
	gchar *name;

	name = g_strdup_printf ("GtkSourcePixbufHelper%d", size);

	icon_size = gtk_icon_size_from_name (name);

	if (icon_size == GTK_ICON_SIZE_INVALID)
	{
		icon_size = gtk_icon_size_register (name, size, size);
	}

	g_free (name);

	set_cache (helper, gtk_widget_render_icon_pixbuf (widget,
	                                                  helper->stock_id,
	                                                  icon_size));
}
Exemplo n.º 14
0
static CanvasItem*
canvas_item_new (GtkWidget     *widget,
                 GtkToolButton *button,
                 gdouble        x,
                 gdouble        y)
{
  CanvasItem *item = NULL;
  const gchar *stock_id;
  GdkPixbuf *pixbuf;

  stock_id = gtk_tool_button_get_stock_id (button);
  pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, GTK_ICON_SIZE_DIALOG);

  if (pixbuf)
    {
      item = g_slice_new0 (CanvasItem);
      item->pixbuf = pixbuf;
      item->x = x;
      item->y = y;
    }

  return item;
}
Exemplo n.º 15
0
GtkWidget *
preferences_window_new (Ekiga::ServiceCore& core)
{
  GmPreferencesWindow *pw = NULL;

  GdkPixbuf *pixbuf = NULL;
  GtkWidget *window = NULL;
  GtkWidget *container = NULL;
  gchar     *filename = NULL;
  std::vector <std::string> device_list;

  gpointer notifier;

  filename = g_build_filename (DATA_DIR, "pixmaps", PACKAGE_NAME, PACKAGE_NAME "-logo.png", NULL);
  window = gnome_prefs_window_new (filename);
  g_free (filename);
  g_object_set_data_full (G_OBJECT (window), "window_name",
			  g_strdup ("preferences_window"), g_free);
  gtk_window_set_title (GTK_WINDOW (window), _("Ekiga Preferences"));
  pixbuf = gtk_widget_render_icon_pixbuf (GTK_WIDGET (window),
					  GTK_STOCK_PREFERENCES,
					  GTK_ICON_SIZE_MENU);
  gtk_window_set_icon (GTK_WINDOW (window), pixbuf);
  gtk_widget_realize (GTK_WIDGET (window));
  g_object_unref (pixbuf);


  /* The GMObject data */
  pw = new GmPreferencesWindow;

  pw->audioinput_core = core.get<Ekiga::AudioInputCore> ("audioinput-core");
  pw->audiooutput_core = core.get<Ekiga::AudioOutputCore> ("audiooutput-core");
  pw->videoinput_core = core.get<Ekiga::VideoInputCore> ("videoinput-core");

  g_object_set_data_full (G_OBJECT (window), "GMObject",
			  pw, (GDestroyNotify) gm_pw_destroy);


  gnome_prefs_window_section_new (window, _("General"));
  container = gnome_prefs_window_subsection_new (window, _("Personal Data"));
  gm_pw_init_general_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  container = gnome_prefs_window_subsection_new (window,
						 _("General Settings"));
  gm_pw_init_interface_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  container = gnome_prefs_window_subsection_new (window, _("Call Options"));
  gm_pw_init_call_options_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  container = gnome_prefs_window_subsection_new (window,
						 _("Sound Events"));
  gm_pw_init_sound_events_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  gnome_prefs_window_section_new (window, _("Protocols"));
  container = gnome_prefs_window_subsection_new (window,
						 _("SIP Settings"));
  gm_pw_init_sip_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  container = gnome_prefs_window_subsection_new (window,
						 _("H.323 Settings"));
  gm_pw_init_h323_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));


  /* The player */
  gnome_prefs_window_section_new (window, _("Audio"));
  container = gnome_prefs_window_subsection_new (window, _("Devices"));
  gm_pw_init_audio_devices_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  container = gnome_prefs_window_subsection_new (window, _("Codecs"));
  gm_pw_init_audio_codecs_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));


  gnome_prefs_window_section_new (window, _("Video"));
  container = gnome_prefs_window_subsection_new (window, _("Devices"));
  gm_pw_init_video_devices_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));

  container = gnome_prefs_window_subsection_new (window, _("Codecs"));
  gm_pw_init_video_codecs_page (window, container);
  gtk_widget_show_all (GTK_WIDGET (container));


  /* That's an usual GtkWindow, connect it to the signals */
  g_signal_connect_swapped (window, "response",
			    G_CALLBACK (gm_window_hide),
			    (gpointer) window);

  gm_window_hide_on_delete (window);

  boost::signals2::connection conn;

  conn = pw->videoinput_core->device_added.connect (boost::bind (&on_videoinput_device_added_cb, _1, _2, window));
  pw->connections.add (conn);
  conn = pw->videoinput_core->device_removed.connect (boost::bind (&on_videoinput_device_removed_cb, _1, _2, window));
  pw->connections.add (conn);

  conn = pw->audioinput_core->device_added.connect (boost::bind (&on_audioinput_device_added_cb, _1, _2, window));
  pw->connections.add (conn);
  conn = pw->audioinput_core->device_removed.connect (boost::bind (&on_audioinput_device_removed_cb, _1, _2, window));
  pw->connections.add (conn);

  conn = pw->audiooutput_core->device_added.connect (boost::bind (&on_audiooutput_device_added_cb, _1, _2, window));
  pw->connections.add(conn);
  conn = pw->audiooutput_core->device_removed.connect (boost::bind (&on_audiooutput_device_removed_cb, _1, _2, window));
  pw->connections.add (conn);

  /* Connect notifiers for SOUND_EVENTS_KEY keys */
  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_incoming_call_sound", 
			  sound_events_list_changed_nt, window);
   pw->notifiers.push_front (notifier);

  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "incoming_call_sound",
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);

  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_ring_tone_sound", 
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);
  
  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "ring_tone_sound", 
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);
  
  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_busy_tone_sound", 
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);
  
  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "busy_tone_sound",
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);
  
  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_new_voicemail_sound", 
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);
  
  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "new_voicemail_sound",
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);

  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "enable_new_message_sound",
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);

  notifier =
    gm_conf_notifier_add (SOUND_EVENTS_KEY "new_message_sound",
			  sound_events_list_changed_nt, window);
  pw->notifiers.push_front (notifier);

  return window;
}