~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/color-rotate/color-rotate-stock.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <gtk/gtk.h>
 
22
 
 
23
#include "color-rotate-stock.h"
 
24
 
 
25
#include "images/color-rotate-stock-pixbufs.h"
 
26
 
 
27
#include "libgimp/stdplugins-intl.h"
 
28
 
 
29
 
 
30
static GtkIconFactory *color_rotate_icon_factory = NULL;
 
31
 
 
32
static GtkStockItem color_rotate_stock_items[] =
 
33
{
 
34
  { STOCK_COLOR_ROTATE_SWITCH_CLOCKWISE,
 
35
    N_("Switch to Clockwise"),    0, 0, NULL },
 
36
  { STOCK_COLOR_ROTATE_SWITCH_COUNTERCLOCKWISE,
 
37
    N_("Switch to C/Clockwise"),  0, 0, NULL },
 
38
  { STOCK_COLOR_ROTATE_CHANGE_ORDER,
 
39
    N_("Change Order of Arrows"), 0, 0, NULL },
 
40
  { STOCK_COLOR_ROTATE_SELECT_ALL,
 
41
    N_("Select All"),             0, 0, NULL }
 
42
};
 
43
 
 
44
 
 
45
static void
 
46
add_stock_icon (const gchar  *stock_id,
 
47
                GtkIconSize   size,
 
48
                const guint8 *inline_data)
 
49
{
 
50
  GtkIconSource *source;
 
51
  GtkIconSet    *set;
 
52
  GdkPixbuf     *pixbuf;
 
53
 
 
54
  source = gtk_icon_source_new ();
 
55
 
 
56
  gtk_icon_source_set_size (source, size);
 
57
  gtk_icon_source_set_size_wildcarded (source, FALSE);
 
58
 
 
59
  pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
 
60
 
 
61
  gtk_icon_source_set_pixbuf (source, pixbuf);
 
62
  g_object_unref (pixbuf);
 
63
 
 
64
  set = gtk_icon_set_new ();
 
65
 
 
66
  gtk_icon_set_add_source (set, source);
 
67
  gtk_icon_source_free (source);
 
68
 
 
69
  gtk_icon_factory_add (color_rotate_icon_factory, stock_id, set);
 
70
 
 
71
  gtk_icon_set_unref (set);
 
72
}
 
73
 
 
74
void
 
75
color_rotate_stock_init (void)
 
76
{
 
77
  static gboolean initialized = FALSE;
 
78
 
 
79
  if (initialized)
 
80
    return;
 
81
 
 
82
  color_rotate_icon_factory = gtk_icon_factory_new ();
 
83
 
 
84
  add_stock_icon (STOCK_COLOR_ROTATE_SWITCH_CLOCKWISE,
 
85
                  GTK_ICON_SIZE_BUTTON, color_rotate_cw);
 
86
  add_stock_icon (STOCK_COLOR_ROTATE_SWITCH_COUNTERCLOCKWISE,
 
87
                  GTK_ICON_SIZE_BUTTON, color_rotate_ccw);
 
88
  add_stock_icon (STOCK_COLOR_ROTATE_CHANGE_ORDER,
 
89
                  GTK_ICON_SIZE_BUTTON, color_rotate_a_b);
 
90
  add_stock_icon (STOCK_COLOR_ROTATE_SELECT_ALL,
 
91
                  GTK_ICON_SIZE_BUTTON, color_rotate_360);
 
92
 
 
93
  gtk_icon_factory_add_default (color_rotate_icon_factory);
 
94
 
 
95
  gtk_stock_add_static (color_rotate_stock_items,
 
96
                        G_N_ELEMENTS (color_rotate_stock_items));
 
97
 
 
98
  initialized = TRUE;
 
99
}