68 |
} else |
} else |
69 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
70 |
gtk_label_attrib(_("(no position)"), |
gtk_label_attrib(_("(no position)"), |
71 |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
72 |
} else |
} else |
73 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
74 |
gtk_label_attrib(_("(invalid position in notes)"), |
gtk_label_attrib(_("(invalid position in notes)"), |
75 |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
76 |
} |
} |
77 |
|
|
78 |
/* this function sets everything related to the coordinate. used to */ |
/* this function sets everything related to the coordinate. used to */ |
80 |
void overview_coordinate_update(cache_context_t *context) { |
void overview_coordinate_update(cache_context_t *context) { |
81 |
if(!context->notes.modified) |
if(!context->notes.modified) |
82 |
return; |
return; |
83 |
|
|
84 |
/* update position labels */ |
/* update position labels */ |
85 |
int strike = notes_get_override(context)?STRIKETHROUGH:STRIKETHROUGH_NONE; |
int strike = notes_get_override(context)?STRIKETHROUGH:STRIKETHROUGH_NONE; |
86 |
char str[32]; |
char str[32]; |
88 |
gtk_label_attrib_set(context->pos_lat_label, str, SIZE_BIG, strike); |
gtk_label_attrib_set(context->pos_lat_label, str, SIZE_BIG, strike); |
89 |
pos_lon_str(str, sizeof(str), context->cache->pos.lon); |
pos_lon_str(str, sizeof(str), context->cache->pos.lon); |
90 |
gtk_label_attrib_set(context->pos_lon_label, str, SIZE_BIG, strike); |
gtk_label_attrib_set(context->pos_lon_label, str, SIZE_BIG, strike); |
91 |
|
|
92 |
/* remove enire hbox and build a new one */ |
/* remove enire hbox and build a new one */ |
93 |
gtk_container_foreach(GTK_CONTAINER(context->bearing_hbox), |
gtk_container_foreach(GTK_CONTAINER(context->bearing_hbox), |
94 |
(GtkCallback)gtk_widget_destroy, NULL); |
(GtkCallback)gtk_widget_destroy, NULL); |
95 |
|
|
96 |
/* update distance/etc */ |
/* update distance/etc */ |
97 |
if(!isnan(context->cache->pos.lat) && |
if(!isnan(context->cache->pos.lat) && |
98 |
!isnan(context->cache->pos.lon)) |
!isnan(context->cache->pos.lon)) |
99 |
bearing_fill_hbox(context->bearing_hbox, context->appdata, |
bearing_fill_hbox(context->bearing_hbox, context->appdata, |
100 |
*get_pos(context->appdata), notes_get_pos(context)); |
*get_pos(context->appdata), notes_get_pos(context)); |
101 |
|
|
102 |
gtk_widget_show_all(context->bearing_hbox); |
gtk_widget_show_all(context->bearing_hbox); |
103 |
} |
} |
104 |
|
|
105 |
static void gcvote_set(cache_context_t *context, vote_t *vote) { |
static void gcvote_set(cache_context_t *context, vote_t *vote) { |
106 |
if(!vote) return; |
if(!vote) return; |
107 |
|
|
108 |
if(context->quality) { |
if(context->quality) { |
109 |
gtk_widget_destroy(context->quality); |
gtk_widget_destroy(context->quality); |
110 |
context->quality = NULL; |
context->quality = NULL; |
111 |
} |
} |
112 |
|
|
113 |
if(context->votes) { |
if(context->votes) { |
114 |
gtk_widget_destroy(context->votes); |
gtk_widget_destroy(context->votes); |
115 |
context->votes = NULL; |
context->votes = NULL; |
116 |
} |
} |
117 |
|
|
118 |
/* update/draw the voting */ |
/* update/draw the voting */ |
119 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
120 |
GtkTooltips *tips = gtk_tooltips_new(); |
GtkTooltips *tips = gtk_tooltips_new(); |
121 |
#endif |
#endif |
122 |
|
|
123 |
char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes, |
char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes, |
124 |
(vote->votes == 1)?_("vote"):_("votes")); |
(vote->votes == 1)?_("vote"):_("votes")); |
125 |
context->votes = GTK_LABEL_SMALL(votes_str); |
context->votes = GTK_LABEL_SMALL(votes_str); |
126 |
gtk_box_pack_start(GTK_BOX(context->votebox), |
gtk_box_pack_start(GTK_BOX(context->votebox), |
127 |
context->votes, FALSE, FALSE, 0); |
context->votes, FALSE, FALSE, 0); |
129 |
context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2)); |
context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2)); |
130 |
gtk_box_pack_start(GTK_BOX(context->votebox), context->quality, |
gtk_box_pack_start(GTK_BOX(context->votebox), context->quality, |
131 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
132 |
|
|
133 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
134 |
char *str = g_strdup_printf(_("Quality: %d"), vote->quality); |
char *str = g_strdup_printf(_("Quality: %d"), vote->quality); |
135 |
gtk_tooltips_set_tip(tips, context->votebox, str, NULL); |
gtk_tooltips_set_tip(tips, context->votebox, str, NULL); |
143 |
|
|
144 |
static void gcvote_callback(vote_t *vote, gpointer data) { |
static void gcvote_callback(vote_t *vote, gpointer data) { |
145 |
cache_context_t *context = (cache_context_t*)data; |
cache_context_t *context = (cache_context_t*)data; |
146 |
|
|
147 |
/* no vote returned: request failed, just cleanup */ |
/* no vote returned: request failed, just cleanup */ |
148 |
if(!vote) { |
if(!vote) { |
149 |
printf("gcvote: callback for failed request\n"); |
printf("gcvote: callback for failed request\n"); |
150 |
|
|
151 |
gcvote_request_free(context->gcvote_request); |
gcvote_request_free(context->gcvote_request); |
152 |
context->gcvote_request = NULL; |
context->gcvote_request = NULL; |
153 |
return; |
return; |
157 |
vote->quality, vote->votes); |
vote->quality, vote->votes); |
158 |
|
|
159 |
gcvote_set(context, vote); |
gcvote_set(context, vote); |
160 |
|
|
161 |
gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem); |
gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem); |
162 |
|
|
163 |
gcvote_request_free(context->gcvote_request); |
gcvote_request_free(context->gcvote_request); |
164 |
context->gcvote_request = NULL; |
context->gcvote_request = NULL; |
165 |
} |
} |
170 |
gtk_box_pack_start_defaults(GTK_BOX(vbox), align); |
gtk_box_pack_start_defaults(GTK_BOX(vbox), align); |
171 |
} |
} |
172 |
|
|
173 |
|
#ifdef FREMANTLE |
174 |
|
#define ICON_SIZE ICON_CACHE_TYPE_2X |
175 |
|
#else |
176 |
|
#define ICON_SIZE ICON_CACHE_TYPE_1_5X |
177 |
|
#endif |
178 |
|
|
179 |
static GtkWidget *cache_overview(cache_context_t *context) { |
static GtkWidget *cache_overview(cache_context_t *context) { |
180 |
GtkWidget *vbox, *ivbox; |
GtkWidget *vbox, *ivbox; |
181 |
GtkWidget *colbox, *tip; |
GtkWidget *colbox, *tip; |
185 |
#endif |
#endif |
186 |
appdata_t *appdata = context->appdata; |
appdata_t *appdata = context->appdata; |
187 |
cache_t *cache = context->cache; |
cache_t *cache = context->cache; |
188 |
|
|
189 |
vbox = gtk_vbox_new(FALSE, 4); |
vbox = gtk_vbox_new(FALSE, 4); |
190 |
|
|
191 |
/* hbox containing the four columns of cache details */ |
/* hbox containing the four columns of cache details */ |
192 |
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
GtkWidget *ihbox = gtk_hbox_new(FALSE, 0); |
193 |
|
|
194 |
/* vbox containing leftmost column (icon and container) */ |
/* vbox containing leftmost column (icon and container) */ |
195 |
colbox = gtk_vbox_new(FALSE, 0); |
colbox = gtk_vbox_new(FALSE, 0); |
196 |
|
|
197 |
if(cache->type != CACHE_TYPE_UNKNOWN) { |
if(cache->type != CACHE_TYPE_UNKNOWN) { |
198 |
gtk_box_pack_start_defaults(GTK_BOX(colbox), |
gtk_box_pack_start_defaults(GTK_BOX(colbox), |
199 |
|
tip = icon_get_widget(ICON_SIZE, cache->type)); |
200 |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
|
|
tip = icon_get_widget(ICON_CACHE_TYPE_2X, cache->type)); |
|
|
#else |
|
|
tip = icon_get_widget(ICON_CACHE_TYPE_1_5X, cache->type)); |
|
|
#endif |
|
|
|
|
201 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
202 |
gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL); |
gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL); |
203 |
#endif |
#endif |
204 |
} |
} |
205 |
|
|
206 |
/* ------------ box containing container info ------------ */ |
/* ------------ box containing container info ------------ */ |
207 |
if(cache->container != CACHE_CONT_UNKNOWN) { |
if(cache->container != CACHE_CONT_UNKNOWN) { |
208 |
ivbox = gtk_vbox_new(FALSE, 0); |
ivbox = gtk_vbox_new(FALSE, 0); |
212 |
gtk_box_pack_start(GTK_BOX(ivbox), |
gtk_box_pack_start(GTK_BOX(ivbox), |
213 |
icon_get_widget(ICON_CACHE_SIZE, cache->container), |
icon_get_widget(ICON_CACHE_SIZE, cache->container), |
214 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
215 |
|
|
216 |
pack_vcentered(colbox, ivbox); |
pack_vcentered(colbox, ivbox); |
217 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
218 |
gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL); |
gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL); |
219 |
#endif |
#endif |
220 |
} |
} |
221 |
|
|
222 |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox); |
223 |
colbox = gtk_vbox_new(FALSE, 0); |
colbox = gtk_vbox_new(FALSE, 0); |
224 |
|
|
225 |
/* ----------------------- id ---------------------------- */ |
/* ----------------------- id ---------------------------- */ |
226 |
if(cache->id) { |
if(cache->id) { |
227 |
int strike = cache->archived?STRIKETHROUGH_RED: |
int strike = cache->archived?STRIKETHROUGH_RED: |
641 |
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
642 |
#endif |
#endif |
643 |
|
|
644 |
gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(finder))), |
gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(finder))), |
645 |
PANGO_ELLIPSIZE_END); |
PANGO_ELLIPSIZE_END); |
646 |
} else |
} else |
647 |
gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END); |
gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END); |
732 |
/* seems to work ... */ |
/* seems to work ... */ |
733 |
if(strcasecmp(name, _("Logs")) == 0) { |
if(strcasecmp(name, _("Logs")) == 0) { |
734 |
gtk_widget_queue_resize(w); |
gtk_widget_queue_resize(w); |
|
} else if(strcasecmp(name, _("TBs")) == 0) { |
|
|
gtk_widget_queue_resize(w); |
|
735 |
} else if(strcasecmp(name, _("Goto")) == 0) { |
} else if(strcasecmp(name, _("Goto")) == 0) { |
736 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
737 |
context->handler_id = gtk_timeout_add(1000, screensaver_update, |
context->handler_id = gtk_timeout_add(1000, screensaver_update, |
738 |
context->appdata); |
context->appdata); |
739 |
#endif |
#endif |
740 |
|
|
741 |
goto_coordinate_update(context); |
goto_coordinate_update(context); |
742 |
} |
} |
743 |
|
|