209 |
|
|
210 |
return chain; |
return chain; |
211 |
} |
} |
212 |
|
|
213 |
|
|
214 |
|
#ifdef USE_HILDON |
215 |
|
static const gint dialog_sizes[][2] = { |
216 |
|
{ 400, 100 }, // SMALL |
217 |
|
{ 450, 300 }, // MEDIUM |
218 |
|
{ 800, 480 }, // LARGE |
219 |
|
{ 640, 100 }, // WIDE |
220 |
|
{ 0, 0 }, // HIGH |
221 |
|
}; |
222 |
|
#else |
223 |
|
static const gint dialog_sizes[][2] = { |
224 |
|
{ 300, 100 }, // SMALL |
225 |
|
{ 400, 300 }, // MEDIUM |
226 |
|
{ 500, 350 }, // LARGE |
227 |
|
{ 450, 100 }, // WIDE |
228 |
|
{ 0, 0 }, // HIGH |
229 |
|
}; |
230 |
|
#endif |
231 |
|
|
232 |
|
/* create a modal dialog using one of the predefined size hints */ |
233 |
|
GtkWidget *misc_dialog_new(guint hint, const char *title, |
234 |
|
GtkWindow *parent, ...) { |
235 |
|
va_list args; |
236 |
|
va_start( args, parent ); |
237 |
|
|
238 |
|
/* create dialog itself */ |
239 |
|
GtkWidget *dialog = gtk_dialog_new(); |
240 |
|
|
241 |
|
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
242 |
|
if(title) gtk_window_set_title(GTK_WINDOW(dialog), title); |
243 |
|
if(parent) gtk_window_set_transient_for(GTK_WINDOW(dialog), parent); |
244 |
|
|
245 |
|
const gchar *button_text = va_arg(args, const gchar *); |
246 |
|
while(button_text) { |
247 |
|
gtk_dialog_add_button(GTK_DIALOG(dialog), button_text, va_arg(args, gint)); |
248 |
|
button_text = va_arg(args, const gchar *); |
249 |
|
} |
250 |
|
|
251 |
|
va_end( args ); |
252 |
|
|
253 |
|
if(hint != MISC_DIALOG_NOSIZE) |
254 |
|
gtk_window_set_default_size(GTK_WINDOW(dialog), |
255 |
|
dialog_sizes[hint][0], dialog_sizes[hint][1]); |
256 |
|
|
257 |
|
return dialog; |
258 |
|
} |