Mercurial > pidgin
comparison src/dialogs.c @ 334:0fa651368776
[gaim-migrate @ 344]
Uh huh
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Sun, 04 Jun 2000 00:42:45 +0000 |
| parents | 0a8b4edc4732 |
| children | f5b199e20d12 |
comparison
equal
deleted
inserted
replaced
| 333:af60432518a6 | 334:0fa651368776 |
|---|---|
| 1974 int i, j = 0, k = 0; | 1974 int i, j = 0, k = 0; |
| 1975 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); | 1975 struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(fontsel)); |
| 1976 | 1976 |
| 1977 if (c) | 1977 if (c) |
| 1978 { | 1978 { |
| 1979 char *tmp = gtk_font_selection_get_font_name(fontsel); | 1979 char *tmp = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
| 1980 strncpy(c->current_fontname, tmp, sizeof(c->current_fontname)); | 1980 strncpy(c->current_fontname, tmp, sizeof(c->current_fontname)); |
| 1981 | 1981 |
| 1982 for (i = 0; i < strlen(c->current_fontname); i++) | 1982 for (i = 0; i < strlen(c->current_fontname); i++) |
| 1983 { | 1983 { |
| 1984 if (c->current_fontname[i] == '-') | 1984 if (c->current_fontname[i] == '-') |
| 1997 { | 1997 { |
| 1998 if (fontface) | 1998 if (fontface) |
| 1999 g_free(fontface); | 1999 g_free(fontface); |
| 2000 | 2000 |
| 2001 fontface = g_malloc(64); | 2001 fontface = g_malloc(64); |
| 2002 fontname = gtk_font_selection_get_font_name(fontsel); | 2002 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); |
| 2003 | 2003 |
| 2004 for (i = 0; i < strlen(fontname); i++) | 2004 for (i = 0; i < strlen(fontname); i++) |
| 2005 { | 2005 { |
| 2006 if (fontname[i] == '-') | 2006 if (fontname[i] == '-') |
| 2007 { | 2007 { |
| 2017 } | 2017 } |
| 2018 | 2018 |
| 2019 cancel_font(NULL, c); | 2019 cancel_font(NULL, c); |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 static GtkWidget *fontseld; | |
| 2023 | |
| 2024 void destroy_fontsel(GtkWidget *w, gpointer d) { | |
| 2025 gtk_widget_destroy(fontseld); | |
| 2026 fontseld = NULL; | |
| 2027 } | |
| 2028 | |
| 2029 void apply_font_dlg(GtkWidget *w, GtkWidget *f) { | |
| 2030 int i, j = 0, k = 0; | |
| 2031 if (fontface) | |
| 2032 g_free(fontface); | |
| 2033 | |
| 2034 fontface = g_malloc(64); | |
| 2035 fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontseld)); | |
| 2036 destroy_fontsel(0, 0); | |
| 2037 for (i = 0; i < strlen(fontname); i++) { | |
| 2038 if (fontname[i] == '-') { | |
| 2039 if (++j > 2) break; | |
| 2040 } else if (j == 2) | |
| 2041 fontface[k++] = fontname[i]; | |
| 2042 } | |
| 2043 fontface[k] = '\0'; | |
| 2044 save_prefs(); | |
| 2045 } | |
| 2046 | |
| 2022 void show_font_dialog(struct conversation *c, GtkWidget *font) | 2047 void show_font_dialog(struct conversation *c, GtkWidget *font) |
| 2023 { | 2048 { |
| 2024 GtkWidget *fontsel; | 2049 |
| 2050 if (!font) { /* we came from the prefs dialog */ | |
| 2051 if (fontseld) return; | |
| 2052 fontseld = gtk_font_selection_dialog_new("Select Font"); | |
| 2053 if (fontname) | |
| 2054 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), fontname); | |
| 2055 else | |
| 2056 gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), DEFAULT_FONT_NAME); | |
| 2057 | |
| 2058 gtk_object_set_user_data(GTK_OBJECT(fontseld), NULL); | |
| 2059 gtk_signal_connect(GTK_OBJECT(fontseld), "delete_event", GTK_SIGNAL_FUNC(destroy_fontsel), NULL); | |
| 2060 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_fontsel), NULL); | |
| 2061 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_font_dlg), NULL); | |
| 2062 gtk_widget_realize(fontseld); | |
| 2063 aol_icon(fontseld->window); | |
| 2064 gtk_widget_show(fontseld); | |
| 2065 gdk_window_raise(fontseld->window); | |
| 2066 return; | |
| 2067 } | |
| 2025 | 2068 |
| 2026 if (!c->font_dialog) | 2069 if (!c->font_dialog) |
| 2027 { | 2070 { |
| 2028 c->font_dialog = gtk_font_selection_dialog_new("Select Font"); | 2071 c->font_dialog = gtk_font_selection_dialog_new("Select Font"); |
| 2029 fontsel = GTK_FONT_SELECTION_DIALOG(c->font_dialog)->fontsel; | |
| 2030 | 2072 |
| 2031 if (font) | 2073 if (font) |
| 2032 gtk_object_set_user_data(GTK_OBJECT(fontsel), c); | 2074 gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), c); |
| 2033 else | 2075 else |
| 2034 gtk_object_set_user_data(GTK_OBJECT(fontsel), NULL); | 2076 gtk_object_set_user_data(GTK_OBJECT(c->font_dialog), NULL); |
| 2035 | 2077 |
| 2036 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, DEFAULT_FONT_NAME); | 2078 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, DEFAULT_FONT_NAME); |
| 2037 | 2079 |
| 2038 gtk_signal_connect(GTK_OBJECT(c->font_dialog), "delete_event", GTK_SIGNAL_FUNC(delete_event_dialog), c); | 2080 gtk_signal_connect(GTK_OBJECT(c->font_dialog), "delete_event", GTK_SIGNAL_FUNC(delete_event_dialog), c); |
| 2039 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_font), fontsel); | 2081 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_font), c->font_dialog); |
| 2040 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_font), c); | 2082 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(c->font_dialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_font), c); |
| 2041 | 2083 |
| 2042 if (fontname) | 2084 if (fontname) |
| 2043 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, fontname); | 2085 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)c->font_dialog, fontname); |
| 2044 else | 2086 else |
