Commit 0b0a0fb00589e051fc7d28361f069375b6913059
1 parent
ac7c336b
Exists in
master
and in
5 other branches
Incluindo mais atributos na toolbar
Showing
1 changed file
with
63 additions
and
0 deletions
Show diff stats
src/pw3270/uiparser/toolbar.c
@@ -52,6 +52,7 @@ | @@ -52,6 +52,7 @@ | ||
52 | { | 52 | { |
53 | GtkWidget * widget = NULL; | 53 | GtkWidget * widget = NULL; |
54 | const gchar * label = NULL; | 54 | const gchar * label = NULL; |
55 | + const gchar * key; | ||
55 | 56 | ||
56 | if(info->element) | 57 | if(info->element) |
57 | { | 58 | { |
@@ -67,6 +68,68 @@ | @@ -67,6 +68,68 @@ | ||
67 | 68 | ||
68 | widget = gtk_toolbar_new(); | 69 | widget = gtk_toolbar_new(); |
69 | 70 | ||
71 | + key = ui_get_attribute("style",names,values); | ||
72 | + if(key) | ||
73 | + { | ||
74 | + static const struct _xlat | ||
75 | + { | ||
76 | + GtkToolbarStyle style; | ||
77 | + const gchar * name; | ||
78 | + } xlat[] = | ||
79 | + { | ||
80 | + { GTK_TOOLBAR_ICONS, "icons" }, | ||
81 | + { GTK_TOOLBAR_TEXT, "text" }, | ||
82 | + { GTK_TOOLBAR_BOTH, "icons&text" }, | ||
83 | + { GTK_TOOLBAR_BOTH, "both" }, | ||
84 | + { GTK_TOOLBAR_BOTH_HORIZ, "horizontal" }, | ||
85 | + { GTK_TOOLBAR_BOTH_HORIZ, "htext" }, | ||
86 | + }; | ||
87 | + | ||
88 | + int f; | ||
89 | + | ||
90 | + for(f=0;f<G_N_ELEMENTS(xlat);f++) | ||
91 | + { | ||
92 | + if(!g_ascii_strcasecmp(key,xlat[f].name)) | ||
93 | + { | ||
94 | + gtk_toolbar_set_style(GTK_TOOLBAR(widget),xlat[f].style); | ||
95 | + break; | ||
96 | + } | ||
97 | + } | ||
98 | + | ||
99 | + } | ||
100 | + | ||
101 | + | ||
102 | + key = ui_get_attribute("size",names,values); | ||
103 | + if(key) | ||
104 | + { | ||
105 | + static const struct _xlat | ||
106 | + { | ||
107 | + GtkIconSize size; | ||
108 | + const gchar * name; | ||
109 | + } xlat[] = | ||
110 | + { | ||
111 | + { GTK_ICON_SIZE_MENU, "menu" }, | ||
112 | + { GTK_ICON_SIZE_SMALL_TOOLBAR, "small" }, | ||
113 | + { GTK_ICON_SIZE_LARGE_TOOLBAR, "large" }, | ||
114 | + { GTK_ICON_SIZE_BUTTON, "button" }, | ||
115 | + { GTK_ICON_SIZE_DND, "dnd" }, | ||
116 | + { GTK_ICON_SIZE_DIALOG, "dialog" }, | ||
117 | + }; | ||
118 | + | ||
119 | + int f; | ||
120 | + | ||
121 | + for(f=0;f<G_N_ELEMENTS(xlat);f++) | ||
122 | + { | ||
123 | + if(!g_ascii_strcasecmp(key,xlat[f].name)) | ||
124 | + { | ||
125 | + gtk_toolbar_set_icon_size(GTK_TOOLBAR(widget),xlat[f].size); | ||
126 | + break; | ||
127 | + } | ||
128 | + } | ||
129 | + | ||
130 | + } | ||
131 | + | ||
132 | + | ||
70 | #if GTK_CHECK_VERSION(2,18,0) | 133 | #if GTK_CHECK_VERSION(2,18,0) |
71 | gtk_widget_set_can_focus(widget,FALSE); | 134 | gtk_widget_set_can_focus(widget,FALSE); |
72 | #else | 135 | #else |