Beispiel #1
0
void extras_register_stock()
{

    static gboolean stock_is_init = FALSE;
    GtkIconFactory *icon_factory = NULL;
    int i;
    if (stock_is_init)
        return;
    stock_is_init = TRUE;
    icon_factory = gtk_icon_factory_new();

    gtk_icon_factory_add_default(icon_factory);

    for (i = 0; i < G_N_ELEMENTS(stock_icons); i++) {
        GdkPixbuf *pixbuf;
        GtkIconSet *iconset;
        gchar *filename;
        filename = find_file(stock_icons[i].dir, stock_icons[i].filename);
        if (filename == NULL)
            continue;

        pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
        g_free(filename);
        iconset = gtk_icon_set_new_from_pixbuf(pixbuf);

        g_object_unref(pixbuf);
        gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset);
        gtk_icon_set_unref(iconset);
    }


}
Beispiel #2
0
void
camorama_stock_init(void) {
    GtkIconFactory* factory = gtk_icon_factory_new();
    GtkIconSet    * set = gtk_icon_set_new ();
    GtkIconSource * source = gtk_icon_source_new();

    gtk_stock_add_static(camorama_items, G_N_ELEMENTS(camorama_items));

    gtk_icon_source_set_size_wildcarded(source, TRUE);
    gtk_icon_source_set_direction_wildcarded(source, TRUE);
    gtk_icon_source_set_state_wildcarded(source, TRUE);

    gtk_icon_source_set_icon_name(source, CAMORAMA_STOCK_WEBCAM);
    gtk_icon_set_add_source(set, source);

    gtk_icon_factory_add(factory, CAMORAMA_STOCK_WEBCAM, set);

    add_default_image(CAMORAMA_STOCK_WEBCAM, 16, camorama_webcam_16);
    add_default_image(CAMORAMA_STOCK_WEBCAM, 24, camorama_webcam_24);

    gtk_icon_factory_add_default(factory);

    gtk_icon_set_unref(set);
    gtk_icon_source_free(source);
}
Beispiel #3
0
static void
meta_stock_icons_init (void)
{
  GtkIconFactory *factory;
  int i;

  MetaStockIcon items[] =
  {
    { METACITY_STOCK_DELETE,   stock_delete_data   },
    { METACITY_STOCK_MINIMIZE, stock_minimize_data },
    { METACITY_STOCK_MAXIMIZE, stock_maximize_data }
  };

  factory = gtk_icon_factory_new ();
  gtk_icon_factory_add_default (factory);

  for (i = 0; i < (gint) G_N_ELEMENTS (items); i++)
    {
      GtkIconSet *icon_set;
      GdkPixbuf *pixbuf;

      pixbuf = gdk_pixbuf_new_from_inline (-1, items[i].icon_data,
					   FALSE,
					   NULL);

      icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
      gtk_icon_factory_add (factory, items[i].stock_id, icon_set);
      gtk_icon_set_unref (icon_set);
      
      g_object_unref (G_OBJECT (pixbuf));
    }

  g_object_unref (G_OBJECT (factory));
}
Beispiel #4
0
MidoriExtension*
extension_init (void)
{
    GtkIconFactory* factory;
    GtkIconSource* icon_source;
    GtkIconSet* icon_set;
    static GtkStockItem items[] =
    {
        { STOCK_PAGE_HOLDER, N_("_Pageholder"), 0, 0, NULL },
    };

    factory = gtk_icon_factory_new ();
    gtk_stock_add (items, G_N_ELEMENTS (items));
    icon_set = gtk_icon_set_new ();
    icon_source = gtk_icon_source_new ();
    gtk_icon_source_set_icon_name (icon_source, GTK_STOCK_ORIENTATION_PORTRAIT);
    gtk_icon_set_add_source (icon_set, icon_source);
    gtk_icon_source_free (icon_source);
    gtk_icon_factory_add (factory, STOCK_PAGE_HOLDER, icon_set);
    gtk_icon_set_unref (icon_set);
    gtk_icon_factory_add_default (factory);
    g_object_unref (factory);

    MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
                                 "name", _("Pageholder"),
                                 "description", "",
                                 "version", "0.1",
                                 "authors", "Christian Dywan <*****@*****.**>",
                                 NULL);

    g_signal_connect (extension, "activate",
                      G_CALLBACK (page_holder_activate_cb), NULL);

    return extension;
}
Beispiel #5
0
/**
 * thunar_stock_init:
 *
 * Initializes the stock icons used by the Thunar
 * file manager.
 **/
void
thunar_stock_init (void)
{
  GtkIconFactory *icon_factory;
  GtkIconSource  *icon_source;
  GtkIconSet     *icon_set;
  guint           n;

  /* allocate a new icon factory for the thunar stock icons */
  icon_factory = gtk_icon_factory_new ();

  /* allocate an icon source */
  icon_source = gtk_icon_source_new ();

  /* register our stock icons */
  for (n = 0; n < G_N_ELEMENTS (thunar_stock_icons); ++n)
    {
      /* setup the icon set */
      icon_set = gtk_icon_set_new ();
      gtk_icon_source_set_icon_name (icon_source, thunar_stock_icons[n].icon);
      gtk_icon_set_add_source (icon_set, icon_source);
      gtk_icon_factory_add (icon_factory, thunar_stock_icons[n].name, icon_set);
      gtk_icon_set_unref (icon_set);
    }

  /* register our icon factory as default */
  gtk_icon_factory_add_default (icon_factory);

  /* cleanup */
  g_object_unref (G_OBJECT (icon_factory));
  gtk_icon_source_free (icon_source);
}
static void
register_stock_icons (void)
{
  static gboolean registered = FALSE;

  if (!registered)
    {
      GdkPixbuf *pixbuf;
      GtkIconFactory *factory;
      GtkIconSet *icon_set;

      static GtkStockItem items[] = {
        { "demo-gtk-logo", "_GTK!", 0, 0, NULL }
      };

      registered = TRUE;

      gtk_stock_add (items, G_N_ELEMENTS (items));

      factory = gtk_icon_factory_new ();
      gtk_icon_factory_add_default (factory);

      pixbuf = gdk_pixbuf_new_from_resource ("/application/gtk-logo-24.png", NULL);

      icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
      gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
      gtk_icon_set_unref (icon_set);
      g_object_unref (pixbuf);

      /* Drop our reference to the factory, GTK will hold a reference. */
      g_object_unref (factory);
    }
}
Beispiel #7
0
void
gfig_stock_init (void)
{
  static gboolean initialized = FALSE;

  if (initialized)
    return;

  gfig_icon_factory = gtk_icon_factory_new ();

  add_stock_icon (GFIG_STOCK_BEZIER,        GTK_ICON_SIZE_BUTTON, stock_bezier);
  add_stock_icon (GFIG_STOCK_CIRCLE,        GTK_ICON_SIZE_BUTTON, stock_circle);
  add_stock_icon (GFIG_STOCK_COPY_OBJECT,   GTK_ICON_SIZE_BUTTON, stock_copy_object);
  add_stock_icon (GFIG_STOCK_CURVE,         GTK_ICON_SIZE_BUTTON, stock_curve);
  add_stock_icon (GFIG_STOCK_DELETE_OBJECT, GTK_ICON_SIZE_BUTTON, stock_delete_object);
  add_stock_icon (GFIG_STOCK_ELLIPSE,       GTK_ICON_SIZE_BUTTON, stock_ellipse);
  add_stock_icon (GFIG_STOCK_LINE,          GTK_ICON_SIZE_BUTTON, stock_line);
  add_stock_icon (GFIG_STOCK_MOVE_OBJECT,   GTK_ICON_SIZE_BUTTON, stock_move_object);
  add_stock_icon (GFIG_STOCK_MOVE_POINT,    GTK_ICON_SIZE_BUTTON, stock_move_point);
  add_stock_icon (GFIG_STOCK_POLYGON,       GTK_ICON_SIZE_BUTTON, stock_polygon);
  add_stock_icon (GFIG_STOCK_RECTANGLE,     GTK_ICON_SIZE_BUTTON, stock_rectangle);
  add_stock_icon (GFIG_STOCK_SELECT_OBJECT, GTK_ICON_SIZE_BUTTON, stock_select_object);
  add_stock_icon (GFIG_STOCK_SHOW_ALL,      GTK_ICON_SIZE_BUTTON, stock_show_all);
  add_stock_icon (GFIG_STOCK_SPIRAL,        GTK_ICON_SIZE_BUTTON, stock_spiral);
  add_stock_icon (GFIG_STOCK_STAR,          GTK_ICON_SIZE_BUTTON, stock_star);

  gtk_icon_factory_add_default (gfig_icon_factory);

  gtk_stock_add_static (gfig_stock_items, G_N_ELEMENTS (gfig_stock_items));

  initialized = TRUE;
}
Beispiel #8
0
void
fr_stock_init (void)
{        
	GtkIconFactory *factory;
        GtkIconSource  *source;
        int             i;
	
	if (stock_initialized)
		return;
	stock_initialized = TRUE;

	gtk_stock_add_static (stock_items, G_N_ELEMENTS (stock_items));

        factory = gtk_icon_factory_new ();
        gtk_icon_factory_add_default (factory);

        source = gtk_icon_source_new ();

        for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) {
                GtkIconSet *set;

                gtk_icon_source_set_icon_name (source, stock_icons [i].icon);

                set = gtk_icon_set_new ();
                gtk_icon_set_add_source (set, source);

                gtk_icon_factory_add (factory, stock_icons [i].stock_id, set);
                gtk_icon_set_unref (set);
        }

        gtk_icon_source_free (source);

        g_object_unref (factory);
}
Beispiel #9
0
void
pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme)
{
	GtkIconFactory *icon_factory;
	gint i;
	GtkIconSet *normal;
	GtkIconSet *translucent = NULL;
	GtkWidget *win;

	if (theme != NULL) {
		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme",
		                        purple_theme_get_name(PURPLE_THEME(theme)));
		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir",
		                      purple_theme_get_dir(PURPLE_THEME(theme)));
	}
	else {
		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme", "");
		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", "");
	}

	icon_factory = gtk_icon_factory_new();

	gtk_icon_factory_add_default(icon_factory);

	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_realize(win);

	for (i = 0; i < G_N_ELEMENTS(sized_status_icons); i++)
	{
		normal = gtk_icon_set_new();
		if (sized_status_icons[i].translucent_name)
			translucent = gtk_icon_set_new();

#define ADD_SIZED_ICON(name, size) \
		if (sized_status_icons[i].name) { \
			add_sized_icon(normal, name, PIDGIN_ICON_THEME(theme), size, sized_status_icons[i], FALSE); \
			if (sized_status_icons[i].translucent_name) \
				add_sized_icon(translucent, name, PIDGIN_ICON_THEME(theme), size, sized_status_icons[i], TRUE); \
		}
		ADD_SIZED_ICON(microscopic, "11");
		ADD_SIZED_ICON(extra_small, "16");
		ADD_SIZED_ICON(small, "22");
		ADD_SIZED_ICON(medium, "32");
		ADD_SIZED_ICON(large, "48");
		ADD_SIZED_ICON(huge, "64");
#undef ADD_SIZED_ICON

		gtk_icon_factory_add(icon_factory, sized_status_icons[i].name, normal);
		gtk_icon_set_unref(normal);

		if (sized_status_icons[i].translucent_name) {
			gtk_icon_factory_add(icon_factory, sized_status_icons[i].translucent_name, translucent);
			gtk_icon_set_unref(translucent);
		}
	}

	gtk_widget_destroy(win);
	g_object_unref(G_OBJECT(icon_factory));
	reload_settings();
}
Beispiel #10
0
static void add_stock_item(void)
{
	GtkIconSet *icon_set;
	GtkIconFactory *factory = gtk_icon_factory_new();
	GtkIconTheme *theme = gtk_icon_theme_get_default();
	GtkStockItem item = { (gchar*)(GEANYSENDMAIL_STOCK_MAIL), (gchar*)(N_("Mail")), 0, 0, (gchar*)(GETTEXT_PACKAGE) };

	if (gtk_icon_theme_has_icon(theme, "mail-message-new"))
	{
		GtkIconSource *icon_source = gtk_icon_source_new();
		icon_set = gtk_icon_set_new();
		gtk_icon_source_set_icon_name(icon_source, "mail-message-new");
		gtk_icon_set_add_source(icon_set, icon_source);
		gtk_icon_source_free(icon_source);
	}
	else
	{
		GdkPixbuf *pb = gdk_pixbuf_new_from_xpm_data(mail_icon);
		icon_set = gtk_icon_set_new_from_pixbuf(pb);
		g_object_unref(pb);
	}
	gtk_icon_factory_add(factory, item.stock_id, icon_set);
	gtk_stock_add(&item, 1);
	gtk_icon_factory_add_default(factory);

	g_object_unref(factory);
	gtk_icon_set_unref(icon_set);
}
Beispiel #11
0
void RenderThemeGtk::initMediaButtons()
{
    static bool iconsInitialized = false;

    if (iconsInitialized)
        return;

    GRefPtr<GtkIconFactory> iconFactory = adoptGRef(gtk_icon_factory_new());
    GtkIconSource* iconSource = gtk_icon_source_new();
    const char* icons[] = { "audio-volume-high", "audio-volume-muted" };

    gtk_icon_factory_add_default(iconFactory.get());

    for (size_t i = 0; i < G_N_ELEMENTS(icons); ++i) {
        gtk_icon_source_set_icon_name(iconSource, icons[i]);
        GtkIconSet* iconSet = gtk_icon_set_new();
        gtk_icon_set_add_source(iconSet, iconSource);
        gtk_icon_factory_add(iconFactory.get(), icons[i], iconSet);
        gtk_icon_set_unref(iconSet);
    }

    gtk_icon_source_free(iconSource);

    iconsInitialized = true;
}
Beispiel #12
0
/**
 * ev_stock_icons_init:
 *
 * Creates a new icon factory, adding the base stock icons to it.
 */
void
ev_stock_icons_init (void)
{
	GtkIconFactory *factory;
	GtkIconSource *source;
	gint i;

	ev_icons_path = g_build_filename (ATRILDATADIR, "icons", NULL);

        factory = gtk_icon_factory_new ();
        gtk_icon_factory_add_default (factory);

	source = gtk_icon_source_new ();

	for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) {
		GtkIconSet *set;

		gtk_icon_source_set_icon_name (source, stock_icons [i].icon);

		set = gtk_icon_set_new ();
		gtk_icon_set_add_source (set, source);

		gtk_icon_factory_add (factory, stock_icons [i].stock_id, set);
		gtk_icon_set_unref (set);
	}

	gtk_icon_source_free (source);

	g_object_unref (G_OBJECT (factory));

	ev_stock_icons_add_icons_path_for_screen (gdk_screen_get_default ());
}
static void
ensure_icon_factory()
{
  if (!gIconFactory) {
    gIconFactory = gtk_icon_factory_new();
    gtk_icon_factory_add_default(gIconFactory);
  }
}
Beispiel #14
0
void
glade_gtk_icon_factory_post_create (GladeWidgetAdaptor *adaptor,
                                    GObject            *object,
                                    GladeCreateReason   reason)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  gtk_icon_factory_add_default (GTK_ICON_FACTORY (object));
G_GNUC_END_IGNORE_DEPRECATIONS
}
Beispiel #15
0
static void
screenshooter_init_stock_icons (void)
{
  GtkIconFactory *factory;

  factory = gtk_icon_factory_new ();
  gtk_icon_factory_add_default (factory);

  register_screenshooter_icon (factory);
  g_object_unref (factory);
}
Beispiel #16
0
void
lshw_gtk_stock_init(void)
{
  static int stock_initted = 0;
  GtkIconFactory *icon_factory;
  int i;
  GtkWidget *win;

  if (stock_initted)
    return;

  stock_initted = 1;

/* Setup the icon factory. */
  icon_factory = gtk_icon_factory_new();

  gtk_icon_factory_add_default(icon_factory);

/* Er, yeah, a hack, but it works. :) */
  win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_realize(win);

  for (i = 0; i < G_N_ELEMENTS(stock_icons); i++)
  {
    GdkPixbuf *pixbuf;
    GtkIconSet *iconset;
    gchar *filename;

      filename = find_file(stock_icons[i].filename);

      if (filename == NULL)
        continue;

      pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
      g_free(filename);

      if(pixbuf)	/* we managed to load something */
      {
        iconset = gtk_icon_set_new_from_pixbuf(pixbuf);
        g_object_unref(G_OBJECT(pixbuf));
        gtk_icon_factory_add(icon_factory, stock_icons[i].name, iconset);
        gtk_icon_set_unref(iconset);
      }
  }

  gtk_widget_destroy(win);

/* register logo icon size */
  gtk_icon_size_register(LSHW_ICON_SIZE_LOGO, LSHW_DEFAULT_ICON_SIZE, LSHW_DEFAULT_ICON_SIZE);

  g_object_unref(G_OBJECT(icon_factory));

  (void) &id;                                     /* avoid "id defined but not used" warning */
}
Beispiel #17
0
void
gap_stock_init (void)
{
  static gboolean initialized = FALSE;

  if(gap_debug)
  {
    printf("gap_stock_init START\n");
  }

  if (initialized)
    return;

  gap_icon_factory = gtk_icon_factory_new ();
  
  add_stock_icon (GAP_STOCK_ADD_POINT          , GTK_ICON_SIZE_BUTTON, gap_add_point);
  add_stock_icon (GAP_STOCK_ANIM_PREVIEW       , GTK_ICON_SIZE_BUTTON, gap_anim_preview);
  add_stock_icon (GAP_STOCK_DELETE_ALL_POINTS  , GTK_ICON_SIZE_BUTTON, gap_delete_all_points);
  add_stock_icon (GAP_STOCK_DELETE_POINT       , GTK_ICON_SIZE_BUTTON, gap_delete_point);
  add_stock_icon (GAP_STOCK_FIRST_POINT        , GTK_ICON_SIZE_BUTTON, gap_first_point);
  add_stock_icon (GAP_STOCK_GRAB_POINTS        , GTK_ICON_SIZE_BUTTON, gap_grab_points);
  add_stock_icon (GAP_STOCK_INSERT_POINT       , GTK_ICON_SIZE_BUTTON, gap_insert_point);
  add_stock_icon (GAP_STOCK_LAST_POINT         , GTK_ICON_SIZE_BUTTON, gap_last_point);
  add_stock_icon (GAP_STOCK_NEXT_POINT         , GTK_ICON_SIZE_BUTTON, gap_next_point);
  add_stock_icon (GAP_STOCK_PAUSE              , GTK_ICON_SIZE_BUTTON, gap_pause);
  add_stock_icon (GAP_STOCK_PLAY               , GTK_ICON_SIZE_BUTTON, gap_play);
  add_stock_icon (GAP_STOCK_PLAY_REVERSE       , GTK_ICON_SIZE_BUTTON, gap_play_reverse);
  add_stock_icon (GAP_STOCK_PREV_POINT         , GTK_ICON_SIZE_BUTTON, gap_prev_point);
  add_stock_icon (GAP_STOCK_RESET_ALL_POINTS   , GTK_ICON_SIZE_BUTTON, gap_reset_all_points);
  add_stock_icon (GAP_STOCK_RESET_POINT        , GTK_ICON_SIZE_BUTTON, gap_reset_point);
  add_stock_icon (GAP_STOCK_ROTATE_FOLLOW      , GTK_ICON_SIZE_BUTTON, gap_rotate_follow);
  add_stock_icon (GAP_STOCK_SOURCE_IMAGE       , GTK_ICON_SIZE_BUTTON, gap_source_image);
  add_stock_icon (GAP_STOCK_STEPMODE           , GTK_ICON_SIZE_BUTTON, gap_stepmode);
  add_stock_icon (GAP_STOCK_UPDATE             , GTK_ICON_SIZE_BUTTON, gap_update);

  add_stock_icon ( GAP_STOCK_RANGE_END         , GTK_ICON_SIZE_BUTTON, gap_range_end);
  add_stock_icon ( GAP_STOCK_RANGE_START       , GTK_ICON_SIZE_BUTTON, gap_range_start);
  add_stock_icon ( GAP_STOCK_SET_RANGE_END     , GTK_ICON_SIZE_BUTTON, gap_set_range_end);
  add_stock_icon ( GAP_STOCK_SET_RANGE_START   , GTK_ICON_SIZE_BUTTON, gap_set_range_start);
  add_stock_icon ( GAP_STOCK_SPEED             , GTK_ICON_SIZE_BUTTON, gap_speed);

  gtk_icon_factory_add_default (gap_icon_factory);

  gtk_stock_add_static (gap_stock_items, G_N_ELEMENTS (gap_stock_items));

  initialized = TRUE;

  if(gap_debug)
  {
    printf("gap_stock_init DONE\n");
  }
}
Beispiel #18
0
static void
init_icon(void)
{
    if (uim_factory)
        return;

    uim_factory = gtk_icon_factory_new();
    gtk_icon_factory_add_default(uim_factory);

    register_icon("im_switcher");
    register_icon("uim-icon");
    register_icon("uim-dict");
    register_icon("null");
}
Beispiel #19
0
Datei: icons.c Projekt: gpg/gpa
static void
register_stock_icons (void)
{
  GdkPixbuf *pixbuf;
  GtkIconFactory *icon_factory;
  GtkIconSet *icon_set;
  GtkIconSource *icon_source;
  gint i;

  icon_factory = gtk_icon_factory_new ();

  for (i = 0; xpms[i].name; i++)
    {
      icon_set = gtk_icon_set_new ();
      icon_source = gtk_icon_source_new ();

      pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) xpms[i].xpm);
      gtk_icon_source_set_pixbuf (icon_source, pixbuf);
      gtk_icon_source_set_direction_wildcarded (icon_source, TRUE);
      gtk_icon_source_set_state_wildcarded (icon_source, TRUE);
      if (! strcmp (xpms[i].name, GPA_STOCK_PUBLIC_KEY)
	  || ! strcmp (xpms[i].name, GPA_STOCK_SECRET_KEY))
	{
	  /* FIXME: For the keylist icons, we disable scaling for now
	     for best visual results.  */
	  gtk_icon_source_set_size_wildcarded (icon_source, FALSE);
	  gtk_icon_source_set_size (icon_source, GTK_ICON_SIZE_LARGE_TOOLBAR);
	}

      gtk_icon_set_add_source (icon_set, icon_source);
      gtk_icon_source_free (icon_source);
      gtk_icon_factory_add (icon_factory, xpms[i].name, icon_set);
      gtk_icon_set_unref (icon_set);
    }

  /* Add a fake stock icon for the clipboard window.  */
  icon_set = gtk_icon_factory_lookup_default (GTK_STOCK_PASTE);
  icon_set = gtk_icon_set_copy (icon_set);
  gtk_icon_factory_add (icon_factory, GPA_STOCK_CLIPBOARD, icon_set);

  /* Add a fake stock icon for the file manager window.  */
  icon_set = gtk_icon_factory_lookup_default (GTK_STOCK_DIRECTORY);
  icon_set = gtk_icon_set_copy (icon_set);
  gtk_icon_factory_add (icon_factory, GPA_STOCK_FILEMAN, icon_set);

  gtk_icon_factory_add_default (icon_factory);

  g_object_unref (icon_factory);
}
Beispiel #20
0
void gxw_init()
{
#if !GLIB_CHECK_VERSION(2, 36, 0) 
	g_type_init();
#endif
	GtkIconFactory *factory = gtk_icon_factory_new();
	for (image_entry *p = image_data; p->icon_name; p++) {
		gtk_icon_factory_add(
			factory, p->icon_name,
			gtk_icon_set_new_from_pixbuf(
				gdk_pixbuf_new_from_inline(
					-1, p->icon_data, FALSE, NULL)));
	}
	gtk_icon_factory_add_default(factory);
}
static void
register_stock_icon(void)
{
	static gboolean registered = FALSE;
  
	if (!registered)
	{
		GdkPixbuf *pixbuf;
		GtkIconFactory *factory;

		static GtkStockItem items[] = {
			{ (gchar*)"abi-table-widget",
			  (gchar*)"_Table",
			  static_cast<GdkModifierType>(0), 0, NULL }
		};
      
		registered = TRUE;

		/* Register our stock items */
		gtk_stock_add (items, G_N_ELEMENTS (items));
      
		/* Add our custom icon factory to the list of defaults */
		factory = gtk_icon_factory_new ();
		gtk_icon_factory_add_default (factory);

		// Must be C cast
		pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)widget_tb_insert_table_xpm);

		/* Register icon to accompany stock item */
		if (pixbuf != NULL)
		{
			GtkIconSet *icon_set;
          
			icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
			gtk_icon_factory_add (factory, "abi-table-widget", icon_set);
			gtk_icon_set_unref (icon_set);
			g_object_unref (G_OBJECT (pixbuf));
		}
		else
		{
			UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
		}
				
		/* Drop our reference to the factory, GTK will hold a reference. */
		g_object_unref (G_OBJECT (factory));
	}
}
Beispiel #22
0
Datei: menus.c Projekt: GNOME/dia
/*
 * Initialise tool actions.
 * The caller owns the return value.
 */
static GtkActionGroup *
create_or_ref_tool_actions (void)
{
  GtkIconFactory *icon_factory;
  GtkActionGroup *actions;
  GtkAction      *action;
  int           i;

  if (tool_actions)
    return g_object_ref (tool_actions);

  actions = gtk_action_group_new ("tool-actions");
  gtk_action_group_set_translation_domain (actions, NULL);
  gtk_action_group_set_translate_func (actions, _dia_translate, NULL, NULL);

  gtk_action_group_add_actions (actions, tool_entries,
				G_N_ELEMENTS (tool_entries), NULL);

  icon_factory = gtk_icon_factory_new ();

  for (i = 0; i < num_tools; i++) {
    action = gtk_action_group_get_action (actions, tool_data[i].action_name);
    if (action != NULL) {
      g_signal_connect (G_OBJECT (action), "activate",
			G_CALLBACK (tool_menu_select),
			&tool_data[i].callback_data);

      gtk_action_set_tooltip (action, _(tool_data[i].tool_desc));

      {
        GdkPixbuf *pb = tool_get_pixbuf (&tool_data[i]);
	GtkIconSet *is = gtk_icon_set_new_from_pixbuf (pb);

	/* not sure if the action name is unique enough */
	gtk_icon_factory_add (icon_factory, tool_data[i].action_name, is);
	gtk_action_set_stock_id (action, tool_data[i].action_name);

	g_object_unref (pb);
      }
    }
    else {
      g_warning ("couldn't find tool menu item %s", tool_data[i].action_name);
    }
  }
  gtk_icon_factory_add_default (icon_factory);
  return actions;
}
Beispiel #23
0
void setup_icons()
{
	GtkIconFactory *icons = gtk_icon_factory_new();

	gtk_icon_factory_add(icons, "slade-mode-verts",
		gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("res/tb_verts16.png", NULL)));
	gtk_icon_factory_add(icons, "slade-mode-lines",
		gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("res/tb_lines16.png", NULL)));
	gtk_icon_factory_add(icons, "slade-mode-sectors",
		gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("res/tb_sectors16.png", NULL)));
	gtk_icon_factory_add(icons, "slade-mode-things",
		gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("res/tb_things16.png", NULL)));
	gtk_icon_factory_add(icons, "slade-mode-3d",
		gtk_icon_set_new_from_pixbuf(gdk_pixbuf_new_from_file("res/tb_3d16.png", NULL)));

	gtk_icon_factory_add_default(icons);
}
Beispiel #24
0
void stock_icons_init(void)
{
    gint i;
    guint n_stock_icons = G_N_ELEMENTS(stock_icons);

    DEBUG("initializing stock icons");

    icon_factory = gtk_icon_factory_new();

    for (i = 0; i < n_stock_icons; i++) {
	stock_icon_register(stock_icons[i].filename,
			    stock_icons[i].stock_id);
    }

    gtk_icon_factory_add_default(icon_factory);

    g_object_unref(icon_factory);
}
Beispiel #25
0
static void
add_stock_entry (const gchar *stock_id, char **xpm_data)
{
	static GtkIconFactory *factory = NULL;
	GdkPixbuf *pixbuf;
	GtkIconSet *icon_set;

	if (!factory) {
		factory =gtk_icon_factory_new ();
		gtk_icon_factory_add_default (factory);
	}

	pixbuf = gdk_pixbuf_new_from_xpm_data ((const gchar **)xpm_data);
	icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
	gtk_icon_factory_add (factory, stock_id, icon_set);
	gtk_icon_set_unref (icon_set);
	g_object_unref (G_OBJECT (pixbuf));
}
Beispiel #26
0
static void accessx_applet_add_stock_icons(AccessxStatusApplet* sapplet, GtkWidget* widget)
{
    GtkIconFactory* factory = gtk_icon_factory_new();
    gint i = 0;
    GtkIconSet* icon_set;

    gtk_icon_factory_add_default(factory);

    while (i <  G_N_ELEMENTS(stock_icons))
    {
        gchar* set_name = stock_icons[i].stock_id;
        icon_set = gtk_icon_set_new();

        do {
            char* filename;
            GtkIconSource* source = gtk_icon_source_new();
            filename = g_build_filename(ACCESSX_PIXMAPS_DIR, stock_icons[i].name, NULL);

            if (g_file_test(filename, G_FILE_TEST_EXISTS) && g_file_test(filename, G_FILE_TEST_IS_REGULAR))
            {
                gtk_icon_source_set_filename(source, filename);
            }
            else
            {
                GtkIconSet* default_set = gtk_icon_factory_lookup_default(GTK_STOCK_MISSING_IMAGE);
                gtk_icon_source_set_pixbuf(source, gtk_icon_set_render_icon(default_set, gtk_widget_get_style(widget), GTK_TEXT_DIR_NONE, GTK_STATE_NORMAL, icon_size_spec, widget, NULL));
            }
            g_free(filename);
            gtk_icon_source_set_state(source, stock_icons[i].state);
            gtk_icon_source_set_state_wildcarded(source, stock_icons[i].wildcarded);
            gtk_icon_set_add_source(icon_set, source);
            gtk_icon_source_free(source);
            ++i;
        } while (set_name == stock_icons[i].stock_id);
        gtk_icon_factory_add(factory, set_name, icon_set);
        gtk_icon_set_unref(icon_set);
    }
    /* now create the stock icons for AltGr, which are internationalized */
    icon_set = accessx_status_applet_altgraph_icon_set (sapplet, widget);
    gtk_icon_factory_add(factory, ALTGRAPH_KEY_ICON, icon_set);
    gtk_icon_set_unref(icon_set);
    sapplet->icon_factory = factory;
}
Beispiel #27
0
EXPORT void
audgui_register_stock_icons(void)
{
    GtkIconFactory *iconfactory = gtk_icon_factory_new();

    load_stock_icon(AUD_STOCK_AUDACIOUS,
                    "audacious.png", iconfactory);
    load_stock_icon(AUD_STOCK_PLAYLIST,
                    "menu_playlist.png", iconfactory);
    load_stock_icon(AUD_STOCK_PLUGIN,
                    "menu_plugin.png", iconfactory);
    load_stock_icon(AUD_STOCK_QUEUETOGGLE,
                    "menu_queue_toggle.png", iconfactory);
    load_stock_icon(AUD_STOCK_RANDOMIZEPL,
                    "menu_randomize_playlist.png", iconfactory);

    gtk_icon_factory_add_default( iconfactory );
    g_object_unref( iconfactory );
}
void
panel_init_stock_icons_and_items (void)
{
	GtkIconFactory *factory;

	panel_menu_icon_size = gtk_icon_size_register ("panel-menu",
						       PANEL_DEFAULT_MENU_ICON_SIZE,
						       PANEL_DEFAULT_MENU_ICON_SIZE);

	panel_menu_bar_icon_size = gtk_icon_size_register ("panel-foobar", 20, 20);

	factory = gtk_icon_factory_new ();
	gtk_icon_factory_add_default (factory);

	panel_init_stock_icons (factory);
	panel_init_stock_items (factory);

	g_object_unref (factory);
}
Beispiel #29
0
Datei: menus.c Projekt: GNOME/dia
static void
register_stock_icons (void)
{
  GtkIconFactory *factory;

  factory = gtk_icon_factory_new ();

  _add_stock_icon_name (factory, DIA_STOCK_GROUP, "dia-group");
  _add_stock_icon_name (factory, DIA_STOCK_UNGROUP, "dia-ungroup");

  _add_stock_icon_name (factory, DIA_STOCK_LAYER_ADD, "dia-layer-add");
  _add_stock_icon_name (factory, DIA_STOCK_LAYER_RENAME, "dia-layer-rename");
  _add_stock_icon_name (factory, DIA_STOCK_OBJECTS_LAYER_ABOVE, "dia-layer-move-above");
  _add_stock_icon_name (factory, DIA_STOCK_OBJECTS_LAYER_BELOW, "dia-layer-move-below");
  _add_stock_icon_name (factory, DIA_STOCK_LAYERS, "dia-layers");

  gtk_icon_factory_add_default (factory);
  g_object_unref (factory);
  factory = NULL;
}
Beispiel #30
0
static void
register_stock_icons (void)
{
  GtkIconFactory *factory;

  factory = gtk_icon_factory_new ();

  _add_stock_icon (factory, DIA_STOCK_GROUP, dia_group_icon, sizeof(dia_group_icon));
  _add_stock_icon (factory, DIA_STOCK_UNGROUP, dia_ungroup_icon, sizeof(dia_ungroup_icon));

  _add_stock_icon (factory, DIA_STOCK_LAYER_ADD, dia_layer_add, sizeof(dia_layer_add));
  _add_stock_icon (factory, DIA_STOCK_LAYER_RENAME, dia_layer_rename, sizeof(dia_layer_rename));
  _add_stock_icon (factory, DIA_STOCK_OBJECTS_LAYER_ABOVE, dia_objects_layer_above, sizeof(dia_objects_layer_above));
  _add_stock_icon (factory, DIA_STOCK_OBJECTS_LAYER_BELOW, dia_objects_layer_below, sizeof(dia_objects_layer_below));
  _add_stock_icon (factory, DIA_STOCK_LAYERS, dia_layers, sizeof(dia_layers));

  gtk_icon_factory_add_default (factory);
  g_object_unref (factory);
  factory = NULL;
}