Mercurial > pidgin
comparison src/dialogs.c @ 230:83dd297aa363
[gaim-migrate @ 240]
Added a few patches from fflewddur to add default away messages, save prefs
after deleting an away message, and *duh* *duh* *duh* *duh* presenting.....
font face selection dialog! Thanks fflewddur.
I also added a pixmap for font face to eventually go on the conversation
windows, but I didn't implement it yet.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 10 May 2000 10:56:25 +0000 |
parents | e8ea7f37e28f |
children | 4a638177f917 |
comparison
equal
deleted
inserted
replaced
229:e8ea7f37e28f | 230:83dd297aa363 |
---|---|
35 | 35 |
36 #include <gtk/gtk.h> | 36 #include <gtk/gtk.h> |
37 #include "gaim.h" | 37 #include "gaim.h" |
38 #include "gtkhtml.h" | 38 #include "gtkhtml.h" |
39 | 39 |
40 #define DEFAULT_FONT_NAME "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1" | |
41 | |
42 char *fontface; | |
43 char *fontname; | |
44 | |
40 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ | 45 static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ |
41 static GList *dialogwindows = NULL; | 46 static GList *dialogwindows = NULL; |
42 static GtkWidget *linkdialog, *colordialog, *exportdialog, *importdialog, *logdialog; | 47 static GtkWidget *linkdialog, *colordialog, *exportdialog, *importdialog, *logdialog, *fontdialog; |
48 | |
49 static void accept_callback(GtkWidget *widget, struct file_transfer *t); | |
43 | 50 |
44 struct create_away { | 51 struct create_away { |
45 GtkWidget *window; | 52 GtkWidget *window; |
46 GtkWidget *entry; | 53 GtkWidget *entry; |
47 GtkWidget *text; | 54 GtkWidget *text; |
1928 | 1935 |
1929 } | 1936 } |
1930 | 1937 |
1931 gtk_widget_show(colordialog); | 1938 gtk_widget_show(colordialog); |
1932 gdk_window_raise(colordialog->window); | 1939 gdk_window_raise(colordialog->window); |
1940 } | |
1941 | |
1942 /*------------------------------------------------------------------------*/ | |
1943 /* Font Selection Dialog */ | |
1944 /*------------------------------------------------------------------------*/ | |
1945 | |
1946 void cancel_font(GtkWidget *widget, GtkWidget *font) | |
1947 { | |
1948 if (font) | |
1949 { | |
1950 set_state_lock(1); | |
1951 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(font), FALSE); | |
1952 set_state_lock(0); | |
1953 } | |
1954 | |
1955 destroy_dialog(NULL, fontdialog); | |
1956 } | |
1957 | |
1958 void apply_font(GtkWidget *widget, GtkFontSelection *fontsel) | |
1959 { | |
1960 /* this could be expanded to include font size, weight, etc. | |
1961 but for now only works with font face */ | |
1962 int i, j = 0, k = 0; | |
1963 | |
1964 fontface = g_malloc(64); | |
1965 fontname = gtk_font_selection_get_font_name(fontsel); | |
1966 | |
1967 for (i = 0; i < strlen(fontname); i++) | |
1968 { | |
1969 if (fontname[i] == '-') | |
1970 { | |
1971 if (++j > 2) | |
1972 break; | |
1973 } | |
1974 else if (j == 2) | |
1975 fontface[k++] = fontname[i]; | |
1976 } | |
1977 fontface[k] = '\0'; | |
1978 | |
1979 save_prefs(); | |
1980 | |
1981 cancel_font(widget, NULL); | |
1982 } | |
1983 | |
1984 void show_font_dialog(GtkWidget *widget, GtkWidget *font) | |
1985 { | |
1986 GtkWidget *fontsel; | |
1987 | |
1988 fontdialog = gtk_font_selection_dialog_new("Select Font"); | |
1989 fontsel = GTK_FONT_SELECTION_DIALOG(fontdialog)->fontsel; | |
1990 | |
1991 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)fontdialog, DEFAULT_FONT_NAME); | |
1992 gtk_window_set_modal(GTK_WINDOW(fontdialog), TRUE); | |
1993 gtk_signal_connect(GTK_OBJECT(fontdialog), "delete_event", GTK_SIGNAL_FUNC(cancel_font), font); | |
1994 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontdialog)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_font), fontsel); | |
1995 gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(fontdialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(cancel_font), font); | |
1996 | |
1997 if (fontname) | |
1998 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)fontdialog, fontname); | |
1999 else | |
2000 gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)fontdialog, DEFAULT_FONT_NAME); | |
2001 | |
2002 gtk_widget_realize(fontdialog); | |
2003 | |
2004 aol_icon(fontdialog->window); | |
2005 | |
2006 gtk_widget_show(fontdialog); | |
2007 gdk_window_raise(fontdialog->window); | |
1933 } | 2008 } |
1934 | 2009 |
1935 /*------------------------------------------------------------------------*/ | 2010 /*------------------------------------------------------------------------*/ |
1936 /* The dialog for import/export */ | 2011 /* The dialog for import/export */ |
1937 /*------------------------------------------------------------------------*/ | 2012 /*------------------------------------------------------------------------*/ |
2012 gtk_file_selection_set_filename(GTK_FILE_SELECTION(exportdialog), buf); | 2087 gtk_file_selection_set_filename(GTK_FILE_SELECTION(exportdialog), buf); |
2013 gtk_signal_connect(GTK_OBJECT(exportdialog), "destroy", | 2088 gtk_signal_connect(GTK_OBJECT(exportdialog), "destroy", |
2014 GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | 2089 GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); |
2015 | 2090 |
2016 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->ok_button), | 2091 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->ok_button), |
2017 "clicked", GTK_SIGNAL_FUNC(do_export), 1); | 2092 "clicked", GTK_SIGNAL_FUNC(do_export), (void*)1); |
2018 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->cancel_button), | 2093 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(exportdialog)->cancel_button), |
2019 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); | 2094 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), exportdialog); |
2020 | 2095 |
2021 | 2096 |
2022 } | 2097 } |
2132 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); | 2207 gtk_file_selection_set_filename(GTK_FILE_SELECTION(importdialog), buf); |
2133 gtk_signal_connect(GTK_OBJECT(importdialog), "destroy", | 2208 gtk_signal_connect(GTK_OBJECT(importdialog), "destroy", |
2134 GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | 2209 GTK_SIGNAL_FUNC(destroy_dialog), importdialog); |
2135 | 2210 |
2136 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), | 2211 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->ok_button), |
2137 "clicked", GTK_SIGNAL_FUNC(do_import), 1); | 2212 "clicked", GTK_SIGNAL_FUNC(do_import), (void*)1); |
2138 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), | 2213 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(importdialog)->cancel_button), |
2139 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), importdialog); | 2214 "clicked", GTK_SIGNAL_FUNC(destroy_dialog), importdialog); |
2140 | 2215 |
2141 | 2216 |
2142 } | 2217 } |