diff options
author | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2008-03-24 15:15:53 +0000 |
---|---|---|
committer | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2008-03-24 15:15:53 +0000 |
commit | 91c4e210ffcebdad673e20785b3b07c61b1db350 (patch) | |
tree | 6e76c1f9c5318173c919e742001877ce20142762 | |
parent | 93d028cdc58ada08644cda008baa41f890ee7d7b (diff) | |
download | gnunet-gtk-91c4e210ffcebdad673e20785b3b07c61b1db350.tar.gz gnunet-gtk-91c4e210ffcebdad673e20785b3b07c61b1db350.zip |
add a global GtkIconFactory to host gnunet-gtk icons that should intergrate the stock
use it for the initial GtkStatusIcon
correct the connected status icon file
-rw-r--r-- | pixmaps/gnunet-gtk-status-connected.svg | 119 | ||||
-rw-r--r-- | src/common/helper.c | 12 | ||||
-rw-r--r-- | src/core/eggtrayicon.c | 27 | ||||
-rw-r--r-- | src/include/gnunetgtk_common.h | 5 |
4 files changed, 42 insertions, 121 deletions
diff --git a/pixmaps/gnunet-gtk-status-connected.svg b/pixmaps/gnunet-gtk-status-connected.svg index 56773393..8acdae41 100644 --- a/pixmaps/gnunet-gtk-status-connected.svg +++ b/pixmaps/gnunet-gtk-status-connected.svg | |||
@@ -14,7 +14,7 @@ | |||
14 | id="svg3440" | 14 | id="svg3440" |
15 | sodipodi:version="0.32" | 15 | sodipodi:version="0.32" |
16 | inkscape:version="0.45.1" | 16 | inkscape:version="0.45.1" |
17 | sodipodi:docbase="/home/milan/Dev/gnunet-gtk/pixmaps/icons" | 17 | sodipodi:docbase="/home/milan/Dev/gnunet-gtk/pixmaps/drafting" |
18 | sodipodi:docname="gnunet-gtk.svg" | 18 | sodipodi:docname="gnunet-gtk.svg" |
19 | inkscape:output_extension="org.inkscape.output.svg.inkscape" | 19 | inkscape:output_extension="org.inkscape.output.svg.inkscape" |
20 | version="1.0" | 20 | version="1.0" |
@@ -38,7 +38,7 @@ | |||
38 | inkscape:window-width="1024" | 38 | inkscape:window-width="1024" |
39 | inkscape:window-height="719" | 39 | inkscape:window-height="719" |
40 | inkscape:window-x="0" | 40 | inkscape:window-x="0" |
41 | inkscape:window-y="49" | 41 | inkscape:window-y="48" |
42 | inkscape:showpageshadow="true" | 42 | inkscape:showpageshadow="true" |
43 | gridempspacing="5" | 43 | gridempspacing="5" |
44 | gridcolor="#23236f" | 44 | gridcolor="#23236f" |
@@ -52,71 +52,6 @@ | |||
52 | <defs | 52 | <defs |
53 | id="defs3"> | 53 | id="defs3"> |
54 | <linearGradient | 54 | <linearGradient |
55 | id="linearGradient3957"> | ||
56 | <stop | ||
57 | style="stop-color:#fffeff;stop-opacity:0.33333334;" | ||
58 | offset="0" | ||
59 | id="stop3959" /> | ||
60 | <stop | ||
61 | style="stop-color:#fffeff;stop-opacity:0.21568628;" | ||
62 | offset="1" | ||
63 | id="stop3961" /> | ||
64 | </linearGradient> | ||
65 | <linearGradient | ||
66 | inkscape:collect="always" | ||
67 | xlink:href="#linearGradient3957" | ||
68 | id="linearGradient3982" | ||
69 | gradientUnits="userSpaceOnUse" | ||
70 | x1="21.993773" | ||
71 | y1="33.955299" | ||
72 | x2="20.917078" | ||
73 | y2="15.814602" | ||
74 | gradientTransform="matrix(0.509273,0,0,0.473768,23.78749,24.00915)" /> | ||
75 | <linearGradient | ||
76 | inkscape:collect="always" | ||
77 | id="linearGradient11503"> | ||
78 | <stop | ||
79 | style="stop-color:#ef2929" | ||
80 | offset="0" | ||
81 | id="stop11505" /> | ||
82 | <stop | ||
83 | style="stop-color:#cc0000" | ||
84 | offset="1" | ||
85 | id="stop11507" /> | ||
86 | </linearGradient> | ||
87 | <linearGradient | ||
88 | inkscape:collect="always" | ||
89 | xlink:href="#linearGradient11503" | ||
90 | id="linearGradient11509" | ||
91 | x1="31.542158" | ||
92 | y1="27.633146" | ||
93 | x2="39.232777" | ||
94 | y2="40.738911" | ||
95 | gradientUnits="userSpaceOnUse" /> | ||
96 | <linearGradient | ||
97 | inkscape:collect="always" | ||
98 | id="linearGradient11521"> | ||
99 | <stop | ||
100 | style="stop-color:#000000;stop-opacity:1;" | ||
101 | offset="0" | ||
102 | id="stop11523" /> | ||
103 | <stop | ||
104 | style="stop-color:#000000;stop-opacity:0;" | ||
105 | offset="1" | ||
106 | id="stop11525" /> | ||
107 | </linearGradient> | ||
108 | <radialGradient | ||
109 | inkscape:collect="always" | ||
110 | xlink:href="#linearGradient11521" | ||
111 | id="radialGradient11527" | ||
112 | cx="34.625000" | ||
113 | cy="46.352013" | ||
114 | fx="34.625000" | ||
115 | fy="46.352013" | ||
116 | r="10.937500" | ||
117 | gradientTransform="matrix(0.93716,5.010655e-6,-1.282451e-6,0.239994,2.175866,34.06314)" | ||
118 | gradientUnits="userSpaceOnUse" /> | ||
119 | <linearGradient | ||
120 | id="linearGradient4750"> | 55 | id="linearGradient4750"> |
121 | <stop | 56 | <stop |
122 | offset="0" | 57 | offset="0" |
@@ -3595,56 +3530,6 @@ | |||
3595 | d="M 1.5438413,18.461044 C 0.44489524,16.960494 0.73862238,15.708678 2.7889337,13.154672 C 4.3108819,11.258825 9.0089856,7.5461814 9.3353762,7.9813886 C 9.4400091,8.1209064 8.7728654,9.6731504 7.8528347,11.430816 C 6.8871558,13.275696 6.285064,14.766601 6.4284763,14.957829 C 6.5718885,15.149055 8.138879,14.26688 10.135476,12.870884 C 15.222614,9.3140149 18.176335,8.0117034 22.172331,7.563771 C 26.560631,7.0718619 30.496826,8.227591 36.763249,11.847893 C 40.412609,13.956237 40.853972,14.137144 41.382098,13.741069 C 41.910221,13.344995 41.911646,12.982701 41.396997,9.9496859 C 41.084034,8.1052802 40.898228,6.5435344 40.984095,6.4791397 C 41.3344,6.2164225 44.888276,10.423535 45.937779,12.343363 C 47.625229,15.430158 47.506191,17.413076 45.558585,18.659867 C 43.307736,20.100783 39.725188,19.081789 35.674054,15.848372 C 32.332102,13.180993 30.216662,12.209106 26.655418,11.704988 C 23.519364,11.261056 20.298596,11.580927 18.171507,12.653858 C 14.596799,14.456987 14.223302,14.81254 12.343691,16.001388 C 10.820751,16.964642 7.8424063,19.041391 5.6468166,19.611049 C 3.6787084,20.121692 2.52275,19.79769 1.5438413,18.461044 z " | 3530 | d="M 1.5438413,18.461044 C 0.44489524,16.960494 0.73862238,15.708678 2.7889337,13.154672 C 4.3108819,11.258825 9.0089856,7.5461814 9.3353762,7.9813886 C 9.4400091,8.1209064 8.7728654,9.6731504 7.8528347,11.430816 C 6.8871558,13.275696 6.285064,14.766601 6.4284763,14.957829 C 6.5718885,15.149055 8.138879,14.26688 10.135476,12.870884 C 15.222614,9.3140149 18.176335,8.0117034 22.172331,7.563771 C 26.560631,7.0718619 30.496826,8.227591 36.763249,11.847893 C 40.412609,13.956237 40.853972,14.137144 41.382098,13.741069 C 41.910221,13.344995 41.911646,12.982701 41.396997,9.9496859 C 41.084034,8.1052802 40.898228,6.5435344 40.984095,6.4791397 C 41.3344,6.2164225 44.888276,10.423535 45.937779,12.343363 C 47.625229,15.430158 47.506191,17.413076 45.558585,18.659867 C 43.307736,20.100783 39.725188,19.081789 35.674054,15.848372 C 32.332102,13.180993 30.216662,12.209106 26.655418,11.704988 C 23.519364,11.261056 20.298596,11.580927 18.171507,12.653858 C 14.596799,14.456987 14.223302,14.81254 12.343691,16.001388 C 10.820751,16.964642 7.8424063,19.041391 5.6468166,19.611049 C 3.6787084,20.121692 2.52275,19.79769 1.5438413,18.461044 z " |
3596 | sodipodi:nodetypes="csssssssssssssssssc" | 3531 | sodipodi:nodetypes="csssssssssssssssssc" |
3597 | id="path3743" /> | 3532 | id="path3743" /> |
3598 | <g | ||
3599 | id="g1676" | ||
3600 | transform="translate(-1.875,-1.0018336)"> | ||
3601 | <path | ||
3602 | transform="translate(1.3125,-0.185898)" | ||
3603 | d="M 45.5625 44.625 A 10.9375 3.5625 0 1 1 23.6875,44.625 A 10.9375 3.5625 0 1 1 45.5625 44.625 z" | ||
3604 | sodipodi:ry="3.5625" | ||
3605 | sodipodi:rx="10.9375" | ||
3606 | sodipodi:cy="44.625" | ||
3607 | sodipodi:cx="34.625" | ||
3608 | id="path11511" | ||
3609 | style="opacity:0.5;fill:url(#radialGradient11527);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||
3610 | sodipodi:type="arc" /> | ||
3611 | <path | ||
3612 | transform="matrix(1.292963,0,0,1.298265,-11.62357,-12.79906)" | ||
3613 | d="M 44.857088 36.818874 A 8.087534 8.087534 0 1 1 28.68202,36.818874 A 8.087534 8.087534 0 1 1 44.857088 36.818874 z" | ||
3614 | sodipodi:ry="8.087534" | ||
3615 | sodipodi:rx="8.087534" | ||
3616 | sodipodi:cy="36.818874" | ||
3617 | sodipodi:cx="36.769554" | ||
3618 | id="path2815" | ||
3619 | style="opacity:1;fill:url(#linearGradient11509);fill-opacity:1;stroke:#a40000;stroke-width:0.77183652;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||
3620 | sodipodi:type="arc" /> | ||
3621 | <rect | ||
3622 | ry="0" | ||
3623 | rx="0" | ||
3624 | y="33.001602" | ||
3625 | x="29.875" | ||
3626 | height="4" | ||
3627 | width="12" | ||
3628 | id="rect2522" | ||
3629 | style="opacity:1;fill:#eeeeec;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> | ||
3630 | <path | ||
3631 | transform="matrix(1.172757,0,0,1.174351,-7.233043,-8.235886)" | ||
3632 | d="M 44.857088 36.818874 A 8.087534 8.087534 0 1 1 28.68202,36.818874 A 8.087534 8.087534 0 1 1 44.857088 36.818874 z" | ||
3633 | sodipodi:ry="8.087534" | ||
3634 | sodipodi:rx="8.087534" | ||
3635 | sodipodi:cy="36.818874" | ||
3636 | sodipodi:cx="36.769554" | ||
3637 | id="path2817" | ||
3638 | style="opacity:0.3;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.85211307;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||
3639 | sodipodi:type="arc" /> | ||
3640 | <path | ||
3641 | inkscape:r_cy="true" | ||
3642 | inkscape:r_cx="true" | ||
3643 | style="fill:url(#linearGradient3982);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1" | ||
3644 | d="M 45.875,34.297252 C 45.875,39.42845 40.601824,31.328475 36.364468,34.480309 C 32.225956,37.558622 25.875,40.2558 25.875,35.124602 C 25.875,29.873333 30.303326,25.001602 35.819064,25.001602 C 41.3348,25.001602 45.875,29.166053 45.875,34.297252 z " | ||
3645 | id="path3955" | ||
3646 | sodipodi:nodetypes="czssc" /> | ||
3647 | </g> | ||
3648 | </g> | 3533 | </g> |
3649 | <g | 3534 | <g |
3650 | inkscape:label="Key" | 3535 | inkscape:label="Key" |
diff --git a/src/common/helper.c b/src/common/helper.c index 66240ebb..e35d0bc3 100644 --- a/src/common/helper.c +++ b/src/common/helper.c | |||
@@ -63,6 +63,8 @@ typedef struct Plugin | |||
63 | 63 | ||
64 | static GladeXML *mainXML; | 64 | static GladeXML *mainXML; |
65 | 65 | ||
66 | static GtkIconFactory *iconFactory; | ||
67 | |||
66 | #if GTK_CHECK_VERSION(2,10,0) | 68 | #if GTK_CHECK_VERSION(2,10,0) |
67 | static GtkStatusIcon *trayIcon; | 69 | static GtkStatusIcon *trayIcon; |
68 | #endif | 70 | #endif |
@@ -184,6 +186,14 @@ GNUNET_GTK_get_main_glade_XML () | |||
184 | /** | 186 | /** |
185 | * Simple accessor method. | 187 | * Simple accessor method. |
186 | */ | 188 | */ |
189 | GtkIconFactory *GNUNET_GTK_get_iconFactory () | ||
190 | { | ||
191 | return iconFactory; | ||
192 | } | ||
193 | |||
194 | /** | ||
195 | * Simple accessor method. | ||
196 | */ | ||
187 | #if GTK_CHECK_VERSION(2,10,0) | 197 | #if GTK_CHECK_VERSION(2,10,0) |
188 | GtkStatusIcon * | 198 | GtkStatusIcon * |
189 | GNUNET_GTK_get_trayIcon () | 199 | GNUNET_GTK_get_trayIcon () |
@@ -357,6 +367,8 @@ GNUNET_GTK_initialize_common_library (struct GNUNET_GE_Context *e, | |||
357 | GNUNET_GE_FATAL | GNUNET_GE_USER | | 367 | GNUNET_GE_FATAL | GNUNET_GE_USER | |
358 | GNUNET_GE_IMMEDIATE, "glade_xml_new", | 368 | GNUNET_GE_IMMEDIATE, "glade_xml_new", |
359 | gladeFile); | 369 | gladeFile); |
370 | iconFactory = gtk_icon_factory_new(); | ||
371 | gtk_icon_factory_add_default (iconFactory); | ||
360 | #if GTK_CHECK_VERSION (2,10,0) | 372 | #if GTK_CHECK_VERSION (2,10,0) |
361 | trayIcon = gtk_status_icon_new (); | 373 | trayIcon = gtk_status_icon_new (); |
362 | #endif | 374 | #endif |
diff --git a/src/core/eggtrayicon.c b/src/core/eggtrayicon.c index e3841af4..052e1d1d 100644 --- a/src/core/eggtrayicon.c +++ b/src/core/eggtrayicon.c | |||
@@ -672,6 +672,8 @@ initTrayIcon () | |||
672 | GtkWidget *trayContextMenu; | 672 | GtkWidget *trayContextMenu; |
673 | GladeXML *trayContextMenuXML; | 673 | GladeXML *trayContextMenuXML; |
674 | GtkWidget *tray_quit; | 674 | GtkWidget *tray_quit; |
675 | GtkIconSet *iconSet; | ||
676 | GtkIconSource *iconSource; | ||
675 | 677 | ||
676 | trayContextMenuXML = | 678 | trayContextMenuXML = |
677 | glade_xml_new (GNUNET_GTK_get_glade_filename (), "trayContextMenu", | 679 | glade_xml_new (GNUNET_GTK_get_glade_filename (), "trayContextMenu", |
@@ -680,12 +682,29 @@ initTrayIcon () | |||
680 | "trayContextMenu"); | 682 | "trayContextMenu"); |
681 | trayIcon = GNUNET_GTK_get_trayIcon (); | 683 | trayIcon = GNUNET_GTK_get_trayIcon (); |
682 | instDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR); | 684 | instDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR); |
685 | iconSet = gtk_icon_set_new (); | ||
686 | iconSource = gtk_icon_source_new (); | ||
683 | iconPath = | 687 | iconPath = |
684 | g_strconcat (instDir, "/../gnunet-gtk/gnunet-gtk-status-nodaemon.svg", | 688 | g_build_filename (instDir, "..", "gnunet-gtk", |
685 | NULL); | 689 | "gnunet-gtk-status-connected.svg", NULL); |
686 | GNUNET_free (instDir); | 690 | gtk_icon_source_set_filename (iconSource, iconPath); |
687 | gtk_status_icon_set_from_file (trayIcon, iconPath); | 691 | g_free (iconPath); |
692 | gtk_icon_set_add_source (iconSet, iconSource); | ||
693 | iconPath = | ||
694 | g_build_filename (instDir, "..", "gnunet-gtk", | ||
695 | "gnunet-gtk-status-connected.png", NULL); | ||
696 | gtk_icon_source_set_filename (iconSource, iconPath); | ||
688 | g_free (iconPath); | 697 | g_free (iconPath); |
698 | gtk_icon_source_set_size_wildcarded (iconSource, FALSE); | ||
699 | gtk_icon_set_add_source (iconSet, iconSource); | ||
700 | |||
701 | gtk_icon_factory_add (GNUNET_GTK_get_iconFactory(), | ||
702 | "gnunet-gtk-status-connected", | ||
703 | iconSet); | ||
704 | gtk_icon_set_unref (iconSet); | ||
705 | gtk_icon_source_free (iconSource); | ||
706 | GNUNET_free (instDir); | ||
707 | gtk_status_icon_set_from_stock (trayIcon, "gnunet-gtk-status-connected"); | ||
689 | gtk_status_icon_set_tooltip (trayIcon, _("GNU's peer-to-peer network")); | 708 | gtk_status_icon_set_tooltip (trayIcon, _("GNU's peer-to-peer network")); |
690 | tray_quit = glade_xml_get_widget (trayContextMenuXML, "tray_quit"); | 709 | tray_quit = glade_xml_get_widget (trayContextMenuXML, "tray_quit"); |
691 | g_signal_connect_swapped (G_OBJECT (tray_quit), "activate", | 710 | g_signal_connect_swapped (G_OBJECT (tray_quit), "activate", |
diff --git a/src/include/gnunetgtk_common.h b/src/include/gnunetgtk_common.h index ff35410b..dbea47cb 100644 --- a/src/include/gnunetgtk_common.h +++ b/src/include/gnunetgtk_common.h | |||
@@ -63,6 +63,11 @@ const char *GNUNET_GTK_get_glade_filename (void); | |||
63 | GladeXML *GNUNET_GTK_get_main_glade_XML (void); | 63 | GladeXML *GNUNET_GTK_get_main_glade_XML (void); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Get the GtkIconFactory for gnunet-gtk | ||
67 | */ | ||
68 | GtkIconFactory *GNUNET_GTK_get_iconFactory (void); | ||
69 | |||
70 | /** | ||
66 | * Get the GtkStatusIcon for the tray icon (if GTK >= 2.10) | 71 | * Get the GtkStatusIcon for the tray icon (if GTK >= 2.10) |
67 | */ | 72 | */ |
68 | #if GTK_CHECK_VERSION(2,10,0) | 73 | #if GTK_CHECK_VERSION(2,10,0) |