From: Sean E. <sea...@us...> - 2002-09-28 21:39:48
|
Update of /cvsroot/gaim/gaim/plugins In directory usw-pr-cvs1:/tmp/cvs-serv20036/plugins Modified Files: chatlist.c notify.c simple.c spellchk.c Log Message: Now you can configure your plugins. Index: chatlist.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/chatlist.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- chatlist.c 26 Sep 2002 07:37:51 -0000 1.14 +++ chatlist.c 28 Sep 2002 21:39:44 -0000 1.15 @@ -293,75 +293,40 @@ parent = NULL; } -void gaim_plugin_config() +GtkWidget *gaim_plugin_config_gtk() { - GtkWidget *vbox; - GtkWidget *frame; - GtkWidget *box; - GtkWidget *table; - GtkWidget *rem_button, *add_button, *ref_button; + GtkWidget *ret, *vbox; GtkWidget *list1, *list2; - GtkWidget *label; GtkWidget *sw1, *sw2; - GtkWidget *item; - GtkWidget *hbox; - GtkWidget *button; - GList *crs = chat_rooms; + GtkWidget *ref_button, *add_button, *rem_button; + GtkWidget *table, *label; + struct chat_room *cr = NULL; GList *items = NULL; - struct chat_room *cr; - - if (parent) { - gtk_widget_show(parent); - return; - } - + GList *crs = chat_rooms; + if (cp) - g_free(cp); - cp = g_new0(struct chat_page, 1); - - parent = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize(parent, 300, 400); - gtk_window_set_title(GTK_WINDOW(parent), "Chat Rooms"); - gtk_window_set_wmclass(GTK_WINDOW(parent), "chatlist", "Gaim"); - gtk_widget_realize(parent); - gtk_signal_connect(GTK_OBJECT(parent), "destroy", - GTK_SIGNAL_FUNC(parent_destroy), NULL); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(parent), vbox); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); + g_free(cp); + cp = g_new0(struct chat_page, 1); - button = picture_button(parent, _("Close"), cancel_xpm); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 5); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(parent_destroy), NULL); - frame = gtk_frame_new(_("Chat Rooms")); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); - gtk_widget_show(frame); + ret = gtk_vbox_new(FALSE, 18); + gtk_container_set_border_width (GTK_CONTAINER (ret), 12); - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(frame), box); - gtk_widget_show(box); + vbox = make_frame(ret, _("Chat Rooms")); table = gtk_table_new(4, 2, FALSE); gtk_widget_show(table); - gtk_box_pack_start(GTK_BOX(box), table, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0); list1 = gtk_list_new(); list2 = gtk_list_new(); sw1 = gtk_scrolled_window_new(NULL, NULL); sw2 = gtk_scrolled_window_new(NULL, NULL); - ref_button = picture_button(parent, _("Refresh"), refresh_xpm); - add_button = picture_button(parent, _("Add"), gnome_add_xpm); - rem_button = picture_button(parent, _("Remove"), gnome_remove_xpm); + ref_button = picture_button(prefs, _("Refresh"), refresh_xpm); + add_button = picture_button(prefs, _("Add"), gnome_add_xpm); + rem_button = picture_button(prefs, _("Remove"), gnome_remove_xpm); gtk_widget_show(list1); gtk_widget_show(sw1); gtk_widget_show(list2); @@ -370,11 +335,6 @@ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw1), list1); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), list2); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw1), - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), - GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - cp->list1 = list1; cp->list2 = list2; @@ -382,8 +342,6 @@ gtk_signal_connect(GTK_OBJECT(rem_button), "clicked", GTK_SIGNAL_FUNC(remove_chat), cp); gtk_signal_connect(GTK_OBJECT(add_button), "clicked", GTK_SIGNAL_FUNC(add_chat), cp); - - label = gtk_label_new(_("List of available chats")); gtk_widget_show(label); @@ -423,8 +381,8 @@ } gtk_list_append_items(GTK_LIST(list2), items); - - gtk_widget_show(parent); + gtk_widget_show_all(ret); + return ret; } static void handle_signon(struct gaim_connection *gc) Index: notify.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/notify.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- notify.c 27 Sep 2002 03:34:54 -0000 1.16 +++ notify.c 28 Sep 2002 21:39:44 -0000 1.17 @@ -41,9 +41,7 @@ */ GtkWidget *really_evil_hack; /* GHashTable *hash = NULL; */ -GtkWidget *Dialog = NULL; -GtkWidget *Click, *Focus, *Type, *InFocus; -GtkWidget *String, *Count, *Quote, *Urgent, *Entry; +GtkWidget *Entry; gchar *title_string = "(*) "; /* predefine some functions, less warnings */ @@ -321,51 +319,6 @@ method ^= METHOD_COUNT; } -void setup_buttons() { - if (choice & NOTIFY_FOCUS) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Focus), TRUE); - else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Click), TRUE); - if (choice & NOTIFY_TYPE) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Type), TRUE); - else - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Type), FALSE); - - if (method & METHOD_STRING) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(String), TRUE); - else - gtk_widget_set_sensitive(Entry, FALSE); - - if (method & METHOD_QUOTE) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Quote), TRUE); - - if (method & METHOD_URGENT) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Urgent), TRUE); - - if (choice & NOTIFY_IN_FOCUS) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(InFocus), TRUE); - - if (method & METHOD_COUNT) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Count), TRUE); - - return; -} - -void close_dialog(GtkWidget *widget, gpointer data) { - gint option = GPOINTER_TO_INT(data); - - if (option > 0) { - title_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(Entry))); - save_notify_prefs(); - } - else if (option < 0) - load_notify_prefs(); - - if (Dialog) - gtk_widget_destroy(Dialog); - Dialog = NULL; -} - char *gaim_plugin_init(GModule *hndl) { handle = hndl; @@ -425,112 +378,57 @@ " where you have not responded to a message yet."; } -void gaim_plugin_config() { - GtkWidget *dialog_vbox; - GtkWidget *button, *label; - GtkWidget *box, *box2, *box3, *box4, *frame; - - if (Dialog) - return; - - /* main config dialog */ - Dialog = gtk_dialog_new(); - gtk_window_set_title(GTK_WINDOW(Dialog), "Notify plugin configuration"); - gtk_window_set_policy(GTK_WINDOW(Dialog), FALSE, FALSE, TRUE); - gtk_signal_connect(GTK_OBJECT(Dialog), "destroy", GTK_SIGNAL_FUNC(close_dialog), GINT_TO_POINTER(-1)); - - dialog_vbox = GTK_DIALOG(Dialog)->vbox; - - /* Ok and Cancel buttons */ - box = gtk_hbox_new(FALSE, 8); - gtk_container_add(GTK_CONTAINER(GTK_DIALOG(Dialog)->action_area), box); - - button = gtk_button_new_with_label(_("Cancel")); - gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0); - gtk_widget_set_usize(button, 80, -2); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_dialog), GINT_TO_POINTER(0)); - - button = gtk_button_new_with_label(_("Ok")); - gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); - gtk_widget_set_usize(button, 80, -2); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_dialog), GINT_TO_POINTER(1)); - - /* warning label */ - label = gtk_label_new(_("Changes in notification removal options take effect only on new conversation windows")); - gtk_box_pack_start(GTK_BOX(dialog_vbox), label, FALSE, FALSE, 1); - - /* main hbox */ - box = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(dialog_vbox), box, FALSE, FALSE, 0); - - box4 = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), box4, FALSE, FALSE, 0); - - /* un-notify choices */ - frame = gtk_frame_new(_("Remove notification when:")); - gtk_box_pack_start(GTK_BOX(box4), frame, FALSE, FALSE, 0); - - box2 = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(frame), box2); - - Focus = gtk_radio_button_new_with_label(NULL, _("Conversation window gains focus.")); - gtk_box_pack_start(GTK_BOX(box2), Focus, FALSE, FALSE, 2); - - Click = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(Focus), _("Conversation window gets clicked.")); - gtk_box_pack_start(GTK_BOX(box2), Click, FALSE, FALSE, 2); - - Type = gtk_check_button_new_with_label(_("Type in conversation window")); - gtk_box_pack_start(GTK_BOX(box2), Type, FALSE, FALSE, 2); - - /* notification method choices */ - /* do I need/want any other notification methods? */ - frame = gtk_frame_new(_("Notification method:")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0); - - box2 = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(frame), box2); - - box3 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(box2), box3, FALSE, FALSE, 0); - - String = gtk_check_button_new_with_label(_("Insert string into window title:")); - gtk_box_pack_start(GTK_BOX(box3), String, FALSE, FALSE, 0); +GtkWidget *gaim_plugin_config_gtk() { + GtkWidget *ret; + GtkWidget *vbox, *hbox; + GtkWidget *toggle; + ret = gtk_vbox_new(FALSE, 18); + gtk_container_set_border_width (GTK_CONTAINER (ret), 12); + vbox = make_frame(ret, _("Notification Methods")); + hbox = gtk_hbox_new(FALSE, 18); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_STRING); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2)); + gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); Entry = gtk_entry_new_with_max_length(7); - gtk_box_pack_start(GTK_BOX(box3), Entry, FALSE, FALSE, 0); + gtk_widget_set_sensitive(GTK_WIDGET(Entry), method & METHOD_STRING); + gtk_box_pack_start(GTK_BOX(hbox), Entry, FALSE, FALSE, 0); gtk_entry_set_text(GTK_ENTRY(Entry), title_string); - Quote = gtk_check_button_new_with_label(_("Quote window title.")); - gtk_box_pack_start(GTK_BOX(box2), Quote, FALSE, FALSE, 0); - - Urgent = gtk_check_button_new_with_label(_("Send URGENT to window manager.")); - gtk_box_pack_start(GTK_BOX(box2), Urgent, FALSE, FALSE, 0); - - label = gtk_label_new(_("Function oddly with tabs:")); - gtk_box_pack_start(GTK_BOX(box2), label, FALSE, FALSE, 0); - - Count = gtk_check_button_new_with_label(_("Insert count of new messages into window title")); - gtk_box_pack_start(GTK_BOX(box2), Count, FALSE, FALSE, 0); + toggle = gtk_check_button_new_with_mnemonic(_("_Quote window title.")); + gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_QUOTE); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3)); - /* general options */ - frame = gtk_frame_new(_("General Options")); - gtk_box_pack_start(GTK_BOX(box4), frame, FALSE, FALSE, 0); + toggle = gtk_check_button_new_with_mnemonic(_("Set Window Manager \"_URGENT\" Hint")); + gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_URGENT); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4)); + + toggle = gtk_check_button_new_with_mnemonic(_("Insert _count of new messages into window title")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), method & METHOD_COUNT); + gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(6)); - box = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER(frame), box); + toggle = gtk_check_button_new_with_mnemonic(_("_Notify even if conversation is in focus.")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_IN_FOCUS); + gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(5)); - InFocus = gtk_check_button_new_with_label(_("Notify even when window is in focus")); - gtk_box_pack_start(GTK_BOX(box), InFocus, FALSE, FALSE, 0); + /*--------------*/ + vbox = make_frame(ret, _("Notification Removal")); + toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window gains _focus.")); + gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_FOCUS); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0)); - /* setup buttons, then attach signals */ - setup_buttons(); - gtk_signal_connect(GTK_OBJECT(Focus), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0)); - gtk_signal_connect(GTK_OBJECT(Type), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(1)); - gtk_signal_connect(GTK_OBJECT(String), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2)); - gtk_signal_connect(GTK_OBJECT(Quote), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3)); - gtk_signal_connect(GTK_OBJECT(Urgent), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4)); - gtk_signal_connect(GTK_OBJECT(InFocus), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(5)); - gtk_signal_connect(GTK_OBJECT(Count), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(6)); + toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); + gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), choice & NOTIFY_TYPE); + gtk_signal_connect(GTK_OBJECT(toggle), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(1)); - gtk_widget_show_all(Dialog); + gtk_widget_show_all(ret); + return ret; } Index: simple.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/simple.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- simple.c 26 Sep 2002 07:37:51 -0000 1.7 +++ simple.c 28 Sep 2002 21:39:44 -0000 1.8 @@ -16,10 +16,6 @@ handle = NULL; } -void gaim_plugin_config() { - printf("configuring plugin.\n"); -} - struct gaim_plugin_description desc; struct gaim_plugin_description *gaim_plugin_desc() { desc.api_version = PLUGIN_API_VERSION; Index: spellchk.c =================================================================== RCS file: /cvsroot/gaim/gaim/plugins/spellchk.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- spellchk.c 26 Sep 2002 07:37:51 -0000 1.23 +++ spellchk.c 28 Sep 2002 21:39:44 -0000 1.24 @@ -358,22 +358,18 @@ } } -void gaim_plugin_config() { - GtkWidget *win; - GtkWidget *vbox; +GtkWidget *gaim_plugin_config_gtk() { + GtkWidget *ret, *vbox, *win; GtkWidget *hbox; GtkWidget *button; GList *w = words; struct replace_words *r; char *pair[2] = {"Replace", "With"}; - - if (configwin) return; - GAIM_DIALOG(configwin); - gtk_widget_set_usize(configwin, 450, 250); - gtk_window_set_title(GTK_WINDOW(configwin), "Spell Check Config"); - gtk_signal_connect(GTK_OBJECT(configwin), "destroy", GTK_SIGNAL_FUNC(close_config), NULL); - vbox = gtk_vbox_new(0, 2); + ret = gtk_vbox_new(FALSE, 18); + gtk_container_set_border_width (GTK_CONTAINER (ret), 12); + + vbox = make_frame(ret, _("Text Replacements")); gtk_container_set_border_width(GTK_CONTAINER(vbox), 4); gtk_container_add(GTK_CONTAINER(configwin), vbox); gtk_widget_show (vbox); @@ -452,5 +448,6 @@ w = w->next; } - gtk_widget_show(configwin); + gtk_widget_show_all(ret); + return ret; } |