comparison src/gtkprefs.c @ 8274:0d9559f3bd2e

[gaim-migrate @ 8998] Tried to make the browser pref page easier to use. Lemme know if I broke anything. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 17 Feb 2004 02:23:35 +0000
parents 9af78e73f0b2
children 35f69749b226
comparison
equal deleted inserted replaced
8273:f24172f53650 8274:0d9559f3bd2e
75 static GtkWidget *prefs = NULL; 75 static GtkWidget *prefs = NULL;
76 static GtkWidget *debugbutton = NULL; 76 static GtkWidget *debugbutton = NULL;
77 static int notebook_page = 0; 77 static int notebook_page = 0;
78 static GtkTreeIter plugin_iter; 78 static GtkTreeIter plugin_iter;
79 79
80 static guint browser_pref_id = 0; 80 static guint browser_pref1_id = 0;
81 static guint browser_pref2_id = 0;
81 static guint proxy_pref_id = 0; 82 static guint proxy_pref_id = 0;
82 static guint sound_pref_id = 0; 83 static guint sound_pref_id = 0;
83 static guint auto_resp_pref_id = 0; 84 static guint auto_resp_pref_id = 0;
84 85
85 /* 86 /*
321 gtk_widget_destroy(sounddialog); 322 gtk_widget_destroy(sounddialog);
322 g_object_unref(G_OBJECT(prefs_away_store)); 323 g_object_unref(G_OBJECT(prefs_away_store));
323 prefs_away_store = NULL; 324 prefs_away_store = NULL;
324 325
325 /* Unregister callbacks. */ 326 /* Unregister callbacks. */
326 gaim_prefs_disconnect_callback(browser_pref_id); 327 gaim_prefs_disconnect_callback(browser_pref1_id);
328 gaim_prefs_disconnect_callback(browser_pref2_id);
327 gaim_prefs_disconnect_callback(proxy_pref_id); 329 gaim_prefs_disconnect_callback(proxy_pref_id);
328 gaim_prefs_disconnect_callback(sound_pref_id); 330 gaim_prefs_disconnect_callback(sound_pref_id);
329 gaim_prefs_disconnect_callback(auto_resp_pref_id); 331 gaim_prefs_disconnect_callback(auto_resp_pref_id);
330 332
331 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { 333 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) {
1317 1319
1318 return browsers; 1320 return browsers;
1319 } 1321 }
1320 1322
1321 static void 1323 static void
1322 browser_changed_cb(const char *name, GaimPrefType type, gpointer value, 1324 browser_changed1_cb(const char *name, GaimPrefType type, gpointer value,
1325 gpointer data)
1326 {
1327 GtkWidget *hbox = data;
1328 const char *browser = value;
1329
1330 gtk_widget_set_sensitive(hbox, strcmp(browser, "custom"));
1331 }
1332
1333 static void
1334 browser_changed2_cb(const char *name, GaimPrefType type, gpointer value,
1323 gpointer data) 1335 gpointer data)
1324 { 1336 {
1325 GtkWidget *hbox = data; 1337 GtkWidget *hbox = data;
1326 const char *browser = value; 1338 const char *browser = value;
1327 1339
1346 browsers = get_available_browsers(); 1358 browsers = get_available_browsers();
1347 if (browsers != NULL) { 1359 if (browsers != NULL) {
1348 label = gaim_gtk_prefs_dropdown_from_list(vbox,_("_Browser:"), GAIM_PREF_STRING, 1360 label = gaim_gtk_prefs_dropdown_from_list(vbox,_("_Browser:"), GAIM_PREF_STRING,
1349 "/gaim/gtk/browsers/browser", 1361 "/gaim/gtk/browsers/browser",
1350 browsers); 1362 browsers);
1351
1352 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); 1363 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
1353 gtk_size_group_add_widget(sg, label); 1364 gtk_size_group_add_widget(sg, label);
1365
1366 hbox = gtk_hbox_new(FALSE, 0);
1367 label = gaim_gtk_prefs_dropdown(hbox, _("_Open link in:"), GAIM_PREF_INT,
1368 "/gaim/gtk/browsers/place",
1369 _("Browser default"), GAIM_BROWSER_DEFAULT,
1370 _("Existing window"), GAIM_BROWSER_CURRENT,
1371 _("New window"), GAIM_BROWSER_NEW_WINDOW,
1372 _("New tab"), GAIM_BROWSER_NEW_TAB,
1373 NULL);
1374 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
1375 gtk_size_group_add_widget(sg, label);
1376 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1377
1378 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom"))
1379 gtk_widget_set_sensitive(hbox, FALSE);
1380 browser_pref1_id = gaim_prefs_connect_callback("/gaim/gtk/browsers/browser",
1381 browser_changed1_cb, hbox);
1354 } 1382 }
1355 1383
1356 hbox = gtk_hbox_new(FALSE, 5); 1384 hbox = gtk_hbox_new(FALSE, 5);
1357 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); 1385 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1358 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); 1386 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)"));
1363 entry = gtk_entry_new(); 1391 entry = gtk_entry_new();
1364 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); 1392 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
1365 1393
1366 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) 1394 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom"))
1367 gtk_widget_set_sensitive(hbox, FALSE); 1395 gtk_widget_set_sensitive(hbox, FALSE);
1368 browser_pref_id = gaim_prefs_connect_callback("/gaim/gtk/browsers/browser", 1396 browser_pref2_id = gaim_prefs_connect_callback("/gaim/gtk/browsers/browser",
1369 browser_changed_cb, hbox); 1397 browser_changed2_cb, hbox);
1370 1398
1371 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); 1399 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0);
1372 1400
1373 gtk_entry_set_text(GTK_ENTRY(entry), 1401 gtk_entry_set_text(GTK_ENTRY(entry),
1374 gaim_prefs_get_string("/gaim/gtk/browsers/command")); 1402 gaim_prefs_get_string("/gaim/gtk/browsers/command"));
1375 g_signal_connect(G_OBJECT(entry), "focus-out-event", 1403 g_signal_connect(G_OBJECT(entry), "focus-out-event",
1376 G_CALLBACK(manual_browser_set), NULL); 1404 G_CALLBACK(manual_browser_set), NULL);
1377 gaim_set_accessible_label (entry, label); 1405 gaim_set_accessible_label (entry, label);
1378
1379 if (browsers != NULL) {
1380 vbox = gaim_gtk_make_frame (ret, _("Browser Options"));
1381 gaim_gtk_prefs_dropdown(vbox, _("_Open link in:"), GAIM_PREF_INT,
1382 "/gaim/gtk/browsers/place",
1383 _("Browser default"), GAIM_BROWSER_DEFAULT,
1384 _("Existing window"), GAIM_BROWSER_CURRENT,
1385 _("New window"), GAIM_BROWSER_NEW_WINDOW,
1386 _("New tab"), GAIM_BROWSER_NEW_TAB,
1387 NULL);
1388 }
1389 1406
1390 gtk_widget_show_all(ret); 1407 gtk_widget_show_all(ret);
1391 return ret; 1408 return ret;
1392 } 1409 }
1393 #endif /*_WIN32*/ 1410 #endif /*_WIN32*/