From 2c2d49fe7b662c2a1e39c2d8162bdcd5c356480c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 31 Mar 2010 23:12:12 +0200 Subject: Whitespace --- src/mainwindow.c | 316 +++++++++++++++++++++++++++---------------------------- 1 file changed, 158 insertions(+), 158 deletions(-) (limited to 'src/mainwindow.c') diff --git a/src/mainwindow.c b/src/mainwindow.c index addb978..da83d4a 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1,6 +1,6 @@ /* * mainwindow.c - * + * * The main (contact list) window * * (c) 2002-2007 Thomas White @@ -8,17 +8,17 @@ * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 dated June, 1991. + * the Free Software Foundation; version 2 dated June, 1991. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this package; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. + * 02111-1307, USA. * */ @@ -71,18 +71,18 @@ static struct { int quitting; /* Whether or not to quit on disconnection. */ int was_menustatuschange; /* Locks to avoid comical looping */ int just_updating; /* when changing status. */ - + /* Common to both states */ GtkWidget *window; /* Overall window */ GtkWidget *swindow; /* Scrolled Window inside window */ GtkWidget *vbox; /* vbox inside swindow */ GtkWidget *top_hbox; /* hbox at top of window */ GtkWidget *bigvbox; /* vbox to put scrolled window and menu bar into */ - + /* For the dispatch state */ GtkWidget *signin_button; /* The Big Red Button */ char *signin_text; /* The text inside the big red button */ - + /* For the online state */ GtkWidget *online_vbox; /* vbox to hold online contacts plus "Online" heading */ GtkWidget *offline_vbox; /* vbox to hold offline contacts plus "Offline" heading */ @@ -98,9 +98,9 @@ static struct { GtkWidget *offline_label; /* "Offline" heading */ GtkWidget *status_vbox; /* vbox to sort out size of status */ GtkActionGroup *action_group; - + char *menu_subject; - + } mainwindow = { MAINWINDOW_STATE_UNDEFINED, @@ -117,7 +117,7 @@ static struct { NULL, NULL, - + NULL, NULL, NULL, @@ -150,7 +150,7 @@ static void mainwindow_signin() { } mainwindow_setonline(); msnprotocol_connect("", 0); - + } /* Internally-called function to undo the effects of mainwindow_setonline */ @@ -183,7 +183,7 @@ static void mainwindow_unsetonline() { gtk_widget_destroy(mainwindow.top_vbox); mainwindow.state = MAINWINDOW_STATE_UNDEFINED; - + if ( mainwindow.quitting ) { /* Bye Bye... */ gtk_widget_destroy(mainwindow.window); @@ -198,7 +198,7 @@ static void mainwindow_unsetdispatch() { gtk_widget_destroy(mainwindow.signin_button); free(mainwindow.signin_text); - + mainwindow.state = MAINWINDOW_STATE_UNDEFINED; } @@ -206,7 +206,7 @@ static void mainwindow_unsetdispatch() { static void mainwindow_fname_labelize() { gfloat yalign; - + gtk_widget_destroy(mainwindow.fname_entry); mainwindow.fname_entry = NULL; mainwindow.friendlyname = gtk_label_new(""); @@ -223,18 +223,18 @@ static void mainwindow_csm_labelize() { gfloat yalign; char *csm; - + gtk_widget_destroy(mainwindow.csm_entry); mainwindow.csm_entry = NULL; mainwindow.csm = gtk_label_new(""); assert(mainwindow.csm != NULL); gtk_misc_get_alignment(GTK_MISC(mainwindow.csm), NULL, &yalign); gtk_misc_set_alignment(GTK_MISC(mainwindow.csm), 0, yalign); - + csm = listcache_getcsm(); mainwindow_setcsm(csm); free(csm); - + gtk_container_add(GTK_CONTAINER(mainwindow.csm_eventbox), mainwindow.csm); gtk_widget_show(mainwindow.csm); @@ -252,10 +252,10 @@ static void mainwindow_fname_activate() { /* Switch back to a label... */ mainwindow_fname_labelize(); - + /* NOW change the name... currently the widget displays the old name, meaning it'll still be accurate if the name change fails. */ - msnprotocol_setmfn(new_mfn); + msnprotocol_setmfn(new_mfn); } @@ -265,15 +265,15 @@ static void mainwindow_csm_activate() { assert(mainwindow.csm_entry != NULL); assert(mainwindow.csm == NULL); - - new_csm = gtk_entry_get_text(GTK_ENTRY(mainwindow.csm_entry)); + + new_csm = strdup(gtk_entry_get_text(GTK_ENTRY(mainwindow.csm_entry))); debug_print("MA: New CSM: %s\n", new_csm); msnprotocol_setcsm(new_csm); /* Switch back to a label... */ mainwindow_csm_labelize(); - + } static int mainwindow_fname_keypress(GtkWidget *widget, GdkEventKey *event) { @@ -281,7 +281,7 @@ static int mainwindow_fname_keypress(GtkWidget *widget, GdkEventKey *event) { if ( event->keyval == GDK_Escape ) { mainwindow_fname_labelize(); } - + return 0; } @@ -291,7 +291,7 @@ static int mainwindow_csm_keypress(GtkWidget *widget, GdkEventKey *event) { if ( event->keyval == GDK_Escape ) { mainwindow_csm_labelize(); } - + return 0; } @@ -305,15 +305,15 @@ void mainwindow_fname_startchange() { /* Already editing! */ return; } - + if ( msnprotocol_signedin() != 1 ) { /* Not ready. */ return; } - + old_mfn = listcache_getmfn(); mfn_decode = routines_urldecode(old_mfn); - + /* Replace friendly name display with editable box. */ gtk_widget_destroy(mainwindow.friendlyname); mainwindow.friendlyname = NULL; @@ -325,12 +325,12 @@ void mainwindow_fname_startchange() { g_signal_connect(GTK_OBJECT(mainwindow.fname_entry), "key-press-event", GTK_SIGNAL_FUNC(mainwindow_fname_keypress), NULL); gtk_container_add(GTK_CONTAINER(mainwindow.fname_eventbox), mainwindow.fname_entry); gtk_widget_show(mainwindow.fname_entry); - + gtk_editable_set_position(GTK_EDITABLE(mainwindow.fname_entry), -1); gtk_widget_grab_focus(mainwindow.fname_entry); - + free(mfn_decode); - + } void mainwindow_csm_startchange() { @@ -341,15 +341,15 @@ void mainwindow_csm_startchange() { /* Already editing! */ return; } - + if ( msnprotocol_signedin() != 1 ) { /* Not ready. */ return; } - + if ( !GTK_WIDGET_VISIBLE(mainwindow.csm_eventbox) ) { - - /* CSM bar is hidden... better fix that first... */ + + /* CSM bar is hidden... better fix that first... */ GtkAction *action; action = gtk_action_group_get_action(mainwindow.action_group, "ShowCSMAction"); @@ -361,9 +361,9 @@ void mainwindow_csm_startchange() { } } - + old_csm = listcache_getcsm_noentities(); - + /* Replace friendly name display with editable box. */ gtk_widget_destroy(mainwindow.csm); mainwindow.csm = NULL; @@ -376,10 +376,10 @@ void mainwindow_csm_startchange() { g_signal_connect(GTK_OBJECT(mainwindow.csm_entry), "key-press-event", GTK_SIGNAL_FUNC(mainwindow_csm_keypress), NULL); gtk_container_add(GTK_CONTAINER(mainwindow.csm_eventbox), mainwindow.csm_entry); gtk_widget_show(mainwindow.csm_entry); - + gtk_editable_set_position(GTK_EDITABLE(mainwindow.csm_entry), -1); gtk_widget_grab_focus(mainwindow.csm_entry); - + } /* Entry point when local friendly name is clicked (to change it) */ @@ -388,9 +388,9 @@ static void mainwindow_fname_clicked(GtkWidget *widget, GdkEventButton *button) if ( button->type != GDK_2BUTTON_PRESS ) { return; } - + mainwindow_fname_startchange(); - + } static void mainwindow_csm_clicked(GtkWidget *widget, GdkEventButton *button) { @@ -398,9 +398,9 @@ static void mainwindow_csm_clicked(GtkWidget *widget, GdkEventButton *button) { if ( button->type != GDK_2BUTTON_PRESS ) { return; } - + mainwindow_csm_startchange(); - + } /* Called by src/msnprotocol.c's CHG handler to update the window. Normally, this won't change anything @@ -414,7 +414,7 @@ void mainwindow_forcestatus(OnlineState status) { /* Order of items in this list MUST match those in mainwindow_setonline() */ switch ( status ) { - + case ONLINE_NLN : newstatus = 0; break; case ONLINE_AWY : newstatus = 1; break; case ONLINE_BSY : newstatus = 2; break; @@ -423,11 +423,11 @@ void mainwindow_forcestatus(OnlineState status) { case ONLINE_LUN : newstatus = 5; break; case ONLINE_HDN : newstatus = 6; break; default : newstatus = -1; break; /* Should never happen */ - + } gtk_combo_box_set_active(GTK_COMBO_BOX(mainwindow.setstatus), newstatus); - + } /* Combobox "changed" handler. */ @@ -435,13 +435,13 @@ static int mainwindow_setstatus() { int newstatus; OnlineState status; - + g_object_get(G_OBJECT(mainwindow.setstatus), "active", &newstatus, NULL); debug_print("MA: mainwindow_setstatus: %i\n", newstatus); - + /* Order of items in this list MUST match those in mainwindow_setonline() */ switch ( newstatus ) { - + case 0 : status = ONLINE_NLN; break; case 1 : status = ONLINE_AWY; break; case 2 : status = ONLINE_BSY; break; @@ -450,9 +450,9 @@ static int mainwindow_setstatus() { case 5 : status = ONLINE_LUN; break; case 6 : status = ONLINE_HDN; break; default : status = ONLINE_ERR; break; - + } - + msnprotocol_setstatus(status); /* If this DIDN'T originate from the menu, update the menu. */ @@ -475,9 +475,9 @@ static int mainwindow_setstatus() { mainwindow.just_updating = 1; gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE); } - + return FALSE; - + } /* Put the main window into its main "online" state */ @@ -494,12 +494,12 @@ void mainwindow_setonline() { } assert(mainwindow.state == MAINWINDOW_STATE_UNDEFINED); - mainwindow.online_vbox = gtk_vbox_new(FALSE, 0); + mainwindow.online_vbox = gtk_vbox_new(FALSE, 0); mainwindow.offline_vbox = gtk_vbox_new(FALSE, 0); mainwindow.top_vbox = gtk_vbox_new(FALSE, 0); mainwindow.status_vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(mainwindow.top_hbox), mainwindow.top_vbox, TRUE, TRUE, 5); - + mainwindow.fname_eventbox = gtk_event_box_new(); assert(mainwindow.fname_eventbox != NULL); mainwindow.friendlyname = gtk_label_new("Connecting..."); @@ -525,7 +525,7 @@ void mainwindow_setonline() { csm = listcache_getcsm(); mainwindow_setcsm(csm); free(csm); - + mainwindow.setstatus = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(mainwindow.setstatus), "Online"); gtk_combo_box_append_text(GTK_COMBO_BOX(mainwindow.setstatus), "Away"); @@ -537,7 +537,7 @@ void mainwindow_setonline() { gtk_signal_connect_object(GTK_OBJECT(mainwindow.setstatus), "changed", GTK_SIGNAL_FUNC(mainwindow_setstatus), NULL); gtk_box_pack_end(GTK_BOX(mainwindow.status_vbox), mainwindow.setstatus, TRUE, FALSE, 0); gtk_box_pack_end(GTK_BOX(mainwindow.top_hbox), mainwindow.status_vbox, FALSE, FALSE, 0); - + /* Add "Online" and "Offline" headings */ mainwindow.online_label = gtk_label_new("---- Online ----"); gtk_box_pack_start(GTK_BOX(mainwindow.online_vbox), mainwindow.online_label, FALSE, FALSE, 0); @@ -550,7 +550,7 @@ void mainwindow_setonline() { gtk_widget_set_usize(GTK_WIDGET(mainwindow.online_vbox), 10, -1); gtk_widget_set_usize(GTK_WIDGET(mainwindow.offline_label), 10, -1); gtk_widget_set_usize(GTK_WIDGET(mainwindow.online_label), 10, -1); - + gtk_widget_show(mainwindow.online_label); gtk_widget_show(mainwindow.offline_label); gtk_widget_show(mainwindow.online_vbox); @@ -578,7 +578,7 @@ void mainwindow_setonline() { gtk_widget_set_sensitive(menuitem, TRUE); menuitem = gtk_ui_manager_get_widget(mainwindow.ui, "/mainwindow/view/show_csm"); gtk_widget_set_sensitive(menuitem, TRUE); - + menuitem = gtk_ui_manager_get_widget(mainwindow.ui, "/mainwindow/status/status_nln"); gtk_widget_set_sensitive(menuitem, TRUE); menuitem = gtk_ui_manager_get_widget(mainwindow.ui, "/mainwindow/status/status_awy"); @@ -613,39 +613,39 @@ void mainwindow_kickdispatch() { const char *username; username = options_username(); - + if ( mainwindow.state != MAINWINDOW_STATE_DISPATCH ) { return; } - + if ( (strlen(username) != 0) && (strlen(options_password()) != 0) && (strlen(options_hostname()) != 0) ) { - + GtkWidget *menuitem; - + strcpy(mainwindow.signin_text, "Not signed in.\n\n"); - strncat(mainwindow.signin_text, username, 200); + strncat(mainwindow.signin_text, username, 200); mainwindow.signin_text[255] = '\0'; strcat(mainwindow.signin_text, "\n\nClick here to connect"); mainwindow.signin_text[255] = '\0'; gtk_label_set_text(GTK_LABEL(GTK_BIN(mainwindow.signin_button)->child), mainwindow.signin_text); - + gtk_widget_set_sensitive(mainwindow.signin_button, TRUE); menuitem = gtk_ui_manager_get_widget(mainwindow.ui, "/mainwindow/connection/sign_in"); gtk_widget_set_sensitive(menuitem, TRUE); - + } else { - + GtkWidget *menuitem; - + gtk_widget_set_sensitive(mainwindow.signin_button, FALSE); menuitem = gtk_ui_manager_get_widget(mainwindow.ui, "/mainwindow/connection/sign_in"); gtk_widget_set_sensitive(menuitem, FALSE); - + strcpy(mainwindow.signin_text, "Please configure your account details"); gtk_label_set_text(GTK_LABEL(GTK_BIN(mainwindow.signin_button)->child), mainwindow.signin_text); /* If this is being called from accountwindow_apply(), this won't re-open the already-open window. */ accountwindow_open(); - + } } @@ -658,7 +658,7 @@ void mainwindow_setdispatch() { if (mainwindow.state == MAINWINDOW_STATE_DISPATCH) { return; /* Nothing to do! */ } else if (mainwindow.state == MAINWINDOW_STATE_ONLINE) { - mainwindow_unsetonline(); + mainwindow_unsetonline(); } assert(mainwindow.state == MAINWINDOW_STATE_UNDEFINED); @@ -669,9 +669,9 @@ void mainwindow_setdispatch() { mainwindow.signin_text = malloc(256); assert(mainwindow.signin_text != NULL); - + gtk_box_pack_start(GTK_BOX(mainwindow.vbox), mainwindow.signin_button, TRUE, TRUE, 5); - + GTK_WIDGET_SET_FLAGS(mainwindow.signin_button, GTK_CAN_DEFAULT); gtk_widget_grab_default(mainwindow.signin_button); gtk_widget_grab_focus(mainwindow.signin_button); @@ -730,8 +730,8 @@ void mainwindow_setdispatch() { gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_action_group_get_action(mainwindow.action_group, "StatusNLNAction")), TRUE); mainwindow.state = MAINWINDOW_STATE_DISPATCH; - mainwindow_kickdispatch(); - + mainwindow_kickdispatch(); + } static void mainwindow_addui_callback(GtkUIManager *ui, GtkWidget *widget, GtkContainer *container) { @@ -742,7 +742,7 @@ static void mainwindow_addui_callback(GtkUIManager *ui, GtkWidget *widget, GtkCo if ( GTK_IS_TOOLBAR(widget) ) { gtk_toolbar_set_show_arrow(GTK_TOOLBAR(widget), TRUE); } - + } static void mainwindow_connection_signout() { @@ -761,7 +761,7 @@ static int mainwindow_confirm_quit_response(GtkWidget *widget, int response) { gtk_widget_destroy(widget); return FALSE; } - + /* Sign out */ if ( msnprotocol_signedin() ) { mainwindow.quitting = 1; @@ -797,19 +797,19 @@ static int mainwindow_togglecsm(GtkWidget *widget) { gboolean active; GtkAction *action; - + action = gtk_action_group_get_action(mainwindow.action_group, "ShowCSMAction"); assert(action != NULL); active = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); - + if ( active ) { - + /* Show CSM */ gtk_widget_show(mainwindow.csm_eventbox); options_sethidecsm(FALSE); - + } else { - + /* Hide CSM - see also mainwindow_sethidecsm() above. */ if ( mainwindow.csm_entry != NULL ) { mainwindow_csm_labelize(); @@ -819,7 +819,7 @@ static int mainwindow_togglecsm(GtkWidget *widget) { } options_save(); - + return FALSE; } @@ -837,8 +837,8 @@ static int mainwindow_toggleoffline(GtkWidget *widget) { action = gtk_action_group_get_action(mainwindow.action_group, "ShowOfflineAction"); assert(action != NULL); active = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); - - if ( active ) { + + if ( active ) { /* Show Offline Contacts */ gtk_widget_show(mainwindow.offline_vbox); options_sethideoffline(FALSE); @@ -848,13 +848,13 @@ static int mainwindow_toggleoffline(GtkWidget *widget) { options_sethideoffline(TRUE); } options_save(); - + return FALSE; } static int mainwindow_menubarstatuschange(GtkRadioAction *action, GtkRadioAction *current, gpointer data) { - + debug_print("MA: mainwindow_menubarstatuschange\n"); if ( !msnprotocol_signedin() ) { @@ -880,32 +880,32 @@ static int mainwindow_menubarstatuschange(GtkRadioAction *action, GtkRadioAction static gint mainwindow_deletecontact(GtkWidget *widget, gpointer data) { printf("MA: Chosen to delete '%s'\n", mainwindow.menu_subject); - + #if 0 GtkWidget *hbox; GtkWidget *vbox; GtkWidget *icon; AddContactWindow *item; - + item = malloc(sizeof(AddContactWindow)); item->window = gtk_dialog_new_with_buttons("Add New Contact", mainwindow_gtkwindow(), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); - + g_signal_connect(item->window, "response", G_CALLBACK(addcontact_response), item); g_signal_connect_swapped(item->window, "response", G_CALLBACK(gtk_widget_destroy), item->window); g_signal_connect(item->window, "destroy", G_CALLBACK(addcontact_destroyed), item); - + hbox = gtk_hbox_new(FALSE, 20); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(item->window)->vbox), hbox); icon = gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_DIALOG); gtk_box_pack_start(GTK_BOX(hbox), icon, TRUE, TRUE, 0); - + vbox = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); - + gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new("Enter the Passport address of your new contact:"), TRUE, TRUE, 0); item->username_entry = gtk_entry_new(); @@ -915,7 +915,7 @@ static gint mainwindow_deletecontact(GtkWidget *widget, gpointer data) { item->allow_toggle = gtk_check_button_new_with_label("Allow this new contact to message you."); gtk_box_pack_start(GTK_BOX(vbox), item->allow_toggle, TRUE, TRUE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(item->allow_toggle), TRUE); - + gtk_container_set_border_width(GTK_CONTAINER(hbox), 10); gtk_widget_show_all(item->window); #endif @@ -929,7 +929,7 @@ static void mainwindow_addmenubar() { GtkActionEntry entries[] = { { "ConnectionAction", NULL, "_Connection", NULL, NULL, NULL }, - + #ifdef HAVE_GTK_2_6_0 { "SignInAction", GTK_STOCK_CONNECT, "_Sign In", NULL, NULL, G_CALLBACK(mainwindow_signin) }, { "SignOutAction", GTK_STOCK_DISCONNECT, "Sign _Out", NULL, NULL, G_CALLBACK(mainwindow_connection_signout) }, @@ -939,32 +939,32 @@ static void mainwindow_addmenubar() { { "SignOutAction", NULL, "Sign _Out", NULL, NULL, G_CALLBACK(mainwindow_connection_signout) }, { "AboutAction", NULL, "_About TuxMessenger", NULL, NULL, G_CALLBACK(about_open) }, #endif /* HAVE_GTK_2_6_0 */ - + { "AccountAction", GTK_STOCK_PROPERTIES, "_Account Details...", NULL, NULL, G_CALLBACK(accountwindow_open) }, { "QuitAction", GTK_STOCK_QUIT, NULL, "Q", "Quit the application", G_CALLBACK(mainwindow_connection_quit) }, { "ViewAction", NULL, "_View", NULL, NULL, NULL }, { "StatusAction", NULL, "_Status", NULL, NULL, NULL }, - { "ChangeNameAction", NULL, "Change Screen _Name...", NULL, NULL, G_CALLBACK(mainwindow_fname_startchange) }, - { "ChangeCSMAction", NULL, "Change Custom _Message...", NULL, NULL, G_CALLBACK(mainwindow_csm_startchange) }, - { "ChangeAvatarAction", NULL, "Change A_vatar...", NULL, NULL, NULL }, + { "ChangeNameAction", NULL, "Change Screen _Name...", NULL, NULL, G_CALLBACK(mainwindow_fname_startchange) }, + { "ChangeCSMAction", NULL, "Change Custom _Message...", NULL, NULL, G_CALLBACK(mainwindow_csm_startchange) }, + { "ChangeAvatarAction", NULL, "Change A_vatar...", NULL, NULL, NULL }, { "ToolsAction", NULL, "_Tools", NULL, NULL, NULL }, - { "AddContactAction", GTK_STOCK_ADD, "_Add Contact...", NULL, NULL,G_CALLBACK(addcontact_open) }, - { "BlockAllowAction", NULL, "_Block and Allow Lists", NULL, NULL, NULL }, - { "ReverseAction", NULL, "_Reverse List", NULL, NULL, NULL }, - { "PreferencesAction", GTK_STOCK_PREFERENCES, "_Preferences...", NULL, NULL, G_CALLBACK(prefswindow_open) }, - { "ListCleanupAction", NULL, "_List Cleanup...", NULL, NULL, G_CALLBACK(listcleanup_open) }, + { "AddContactAction", GTK_STOCK_ADD, "_Add Contact...", NULL, NULL,G_CALLBACK(addcontact_open) }, + { "BlockAllowAction", NULL, "_Block and Allow Lists", NULL, NULL, NULL }, + { "ReverseAction", NULL, "_Reverse List", NULL, NULL, NULL }, + { "PreferencesAction", GTK_STOCK_PREFERENCES, "_Preferences...", NULL, NULL, G_CALLBACK(prefswindow_open) }, + { "ListCleanupAction", NULL, "_List Cleanup...", NULL, NULL, G_CALLBACK(listcleanup_open) }, { "HelpAction", NULL, "_Help", NULL, NULL, NULL }, - - { "ContactMessageAction", GTK_STOCK_NEW, "New _Message", NULL, NULL, NULL }, - { "ContactSendFileAction", GTK_STOCK_OPEN, "Send _File", NULL, NULL, NULL }, - { "ContactBlockAction", GTK_STOCK_NO, "_Block Contact", NULL, NULL, NULL }, - { "ContactUnblockAction", GTK_STOCK_YES, "_Unblock Contact", NULL, NULL, NULL }, - { "ContactDeleteAction", GTK_STOCK_DELETE, "_Delete Contact", NULL, NULL, G_CALLBACK(mainwindow_deletecontact) }, - + + { "ContactMessageAction", GTK_STOCK_NEW, "New _Message", NULL, NULL, NULL }, + { "ContactSendFileAction", GTK_STOCK_OPEN, "Send _File", NULL, NULL, NULL }, + { "ContactBlockAction", GTK_STOCK_NO, "_Block Contact", NULL, NULL, NULL }, + { "ContactUnblockAction", GTK_STOCK_YES, "_Unblock Contact", NULL, NULL, NULL }, + { "ContactDeleteAction", GTK_STOCK_DELETE, "_Delete Contact", NULL, NULL, G_CALLBACK(mainwindow_deletecontact) }, + }; GtkToggleActionEntry toggles[] = { @@ -976,12 +976,12 @@ static void mainwindow_addmenubar() { GtkRadioActionEntry radios_status[] = { { "StatusNLNAction", NULL, "_Online", "O", NULL, ONLINE_NLN }, - { "StatusAWYAction", NULL, "_Away", "A", NULL, ONLINE_AWY }, - { "StatusBSYAction", NULL, "_Busy", NULL, NULL, ONLINE_BSY }, - { "StatusBRBAction", NULL, "Be _Right Back", "B", NULL, ONLINE_BRB }, - { "StatusPHNAction", NULL, "On The _Phone", NULL, NULL, ONLINE_PHN }, - { "StatusLUNAction", NULL, "Out To _Lunch", "L", NULL, ONLINE_LUN }, - { "StatusHDNAction", NULL, "Appear O_ffline", NULL, NULL, ONLINE_HDN }, + { "StatusAWYAction", NULL, "_Away", "A", NULL, ONLINE_AWY }, + { "StatusBSYAction", NULL, "_Busy", NULL, NULL, ONLINE_BSY }, + { "StatusBRBAction", NULL, "Be _Right Back", "B", NULL, ONLINE_BRB }, + { "StatusPHNAction", NULL, "On The _Phone", NULL, NULL, ONLINE_PHN }, + { "StatusLUNAction", NULL, "Out To _Lunch", "L", NULL, ONLINE_LUN }, + { "StatusHDNAction", NULL, "Appear O_ffline", NULL, NULL, ONLINE_HDN }, }; GtkRadioActionEntry radios_sorting[] = { @@ -1007,16 +1007,16 @@ static void mainwindow_addmenubar() { g_signal_connect(mainwindow.ui, "add_widget", G_CALLBACK(mainwindow_addui_callback), mainwindow.bigvbox); gtk_widget_show(mainwindow.bigvbox); if ( gtk_ui_manager_add_ui_from_file(mainwindow.ui, DATADIR"/tuxmessenger/mainwindow.ui", &error) == 0 ) { - + /* :( */ debug_print("MA: Error loading main window menu bar: %s\n", error->message); exit(1); - + } - + gtk_window_add_accel_group(GTK_WINDOW(mainwindow.window), gtk_ui_manager_get_accel_group(mainwindow.ui)); gtk_ui_manager_ensure_update(mainwindow.ui); - + } /* Create and open the main window, in dispatch state */ @@ -1034,7 +1034,7 @@ void mainwindow_open() { /* Add menu bar */ mainwindow_addmenubar(); - + /* Create a scrolled window to hold the contacts. */ mainwindow.swindow = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(mainwindow.swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); @@ -1046,12 +1046,12 @@ void mainwindow_open() { mainwindow.top_hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(mainwindow.vbox), mainwindow.top_hbox, FALSE, FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(mainwindow.vbox), 6); - + g_signal_connect(G_OBJECT(mainwindow.window), "delete-event", GTK_SIGNAL_FUNC(mainwindow_confirm_quit), NULL); mainwindow.state = MAINWINDOW_STATE_UNDEFINED; mainwindow_setdispatch(); gtk_widget_show_all(mainwindow.window); - + } /* Trivial function to add an accelerator group to the window, e.g. for the "statusmenu" */ @@ -1076,7 +1076,7 @@ static char *mainwindow_decodestatus(OnlineState status) { } else if ( status == ONLINE_LUN ) { return "[Food] "; } - + return "[Whoops] "; } @@ -1089,9 +1089,9 @@ void mainwindow_setmfn(const char *new_friendlyname) { assert(new_friendlyname != NULL); assert(mainwindow.friendlyname != NULL); - + decoded_fname = routines_urldecode(new_friendlyname); - + final_fname = malloc(strlen(new_friendlyname) + 11); sprintf(final_fname, "––– %s", decoded_fname); gtk_label_set_text(GTK_LABEL(mainwindow.friendlyname), final_fname); @@ -1107,11 +1107,11 @@ void mainwindow_setcsm(const char *new_csm) { assert(new_csm != NULL); assert(mainwindow.csm != NULL); - + csm_markup = malloc(strlen(new_csm)+50); new_csm_edited = routines_killtriangles(new_csm); sprintf(csm_markup, "%s", new_csm_edited); - + gtk_label_set_markup(GTK_LABEL(mainwindow.csm), csm_markup); free(new_csm_edited); free(csm_markup); @@ -1121,9 +1121,9 @@ void mainwindow_setcsm(const char *new_csm) { static void mainwindow_adjustmenu_popup(GtkWidget *adjust_button, char *username, guint button, guint time) { GtkWidget *menu; - + menu = gtk_ui_manager_get_widget(mainwindow.ui, "/ui/contact"); - + /* It is conceivable that neither of these would be true */ if ( contactlist_isonlist("BL", username) ) { GtkWidget *disable = gtk_ui_manager_get_widget(mainwindow.ui, "/ui/contact/block"); @@ -1133,8 +1133,8 @@ static void mainwindow_adjustmenu_popup(GtkWidget *adjust_button, char *username GtkWidget *disable = gtk_ui_manager_get_widget(mainwindow.ui, "/ui/contact/unblock"); gtk_widget_set_sensitive(GTK_WIDGET(disable), FALSE); } - - + + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, time); mainwindow.menu_subject = username; @@ -1148,19 +1148,19 @@ static gint mainwindow_contact_event(GtkWidget *button, GdkEvent *event, char *u mainwindow_adjustmenu_popup(button, username, ((GdkEventButton *)event)->button, ((GdkEventButton *)event)->time); } } - + return 0; - + } /* Contact button clicked */ static gint mainwindow_contact_clicked(GtkWidget *button, char *username) { - if ( msnprotocol_status() == ONLINE_HDN ) { + if ( msnprotocol_status() == ONLINE_HDN ) { error_report("You can't send messages while you are Invisible!"); return 0; } - + messagewindow_create_if_none(username, NULL); return 0; @@ -1178,14 +1178,14 @@ static void mainwindow_userdnd_get(GtkWidget *widget, GdkDragContext *drag_conte static void mainwindow_userdnd_receive(GtkWidget *widget, GdkDragContext *drag_context, gint x, gint y, GtkSelectionData *seldata, guint info, guint time, char *username1) { char *username2; - + username2 = (char *)seldata->data; - - if ( msnprotocol_status() == ONLINE_HDN ) { + + if ( msnprotocol_status() == ONLINE_HDN ) { error_report("You can't send messages while you are Invisible!"); return; } - + if ( strcmp(username1, username2) == 0 ) { debug_print("MA: Try just clicking...\n"); return; @@ -1207,7 +1207,7 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * char *csmtext2; char *tooltips_string; char *csmtext_noentities; - + assert(uicontact->hbox == NULL); assert(uicontact->adjustbutton == NULL); assert(uicontact->button == NULL); @@ -1216,25 +1216,25 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * assert(uicontact->tooltips == NULL); assert(status != ONLINE_HDN); /* Doesn't happen for contacts */ - + /* Create the button */ uicontact->button = gtk_button_new(); assert(uicontact->button != NULL); GTK_WIDGET_UNSET_FLAGS(uicontact->button, GTK_CAN_FOCUS); gtk_button_set_relief(GTK_BUTTON(uicontact->button), GTK_RELIEF_NONE); - + uicontact->hbox = gtk_hbox_new(FALSE, 0); assert(uicontact->hbox != NULL); gtk_container_add(GTK_CONTAINER(uicontact->button), uicontact->hbox); - + uicontact->pixmap = statusicons_pixmap(status); gtk_box_pack_start(GTK_BOX(uicontact->hbox), uicontact->pixmap, FALSE, FALSE, 0); - + /* Label containing status, friendly name and CSM */ friendlynametext = routines_urldecode(friendlyname); friendlynametext2 = routines_killtriangles_and_ampersands(friendlynametext); if ( status != ONLINE_FLN ) { - + csmtext = contactlist_csm(username, 0); csmtext_noentities = contactlist_csm(username, 1); if ( csmtext == NULL ) { @@ -1267,9 +1267,9 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * free(csmtext2); g_signal_connect(uicontact->button, "clicked", GTK_SIGNAL_FUNC(mainwindow_contact_clicked), (gpointer)username); - + } else { - + friendlynametext = routines_urldecode(friendlyname); uicontact->label = gtk_label_new(friendlynametext); assert(uicontact->label != NULL); @@ -1280,7 +1280,7 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * } gtk_box_pack_start(GTK_BOX(uicontact->hbox), uicontact->label, TRUE, TRUE, 3); - + /* Packing and signal handling */ if ( status != ONLINE_FLN ) { gtk_box_pack_end(GTK_BOX(mainwindow.online_vbox), uicontact->button, TRUE, FALSE, 0); @@ -1288,13 +1288,13 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * gtk_box_pack_end(GTK_BOX(mainwindow.offline_vbox), uicontact->button, TRUE, FALSE, 0); } g_signal_connect(uicontact->button, "event", GTK_SIGNAL_FUNC(mainwindow_contact_event), (gpointer)username); - + /* Tooltips */ uicontact->tooltips = gtk_tooltips_new(); assert(uicontact->tooltips != NULL); gtk_tooltips_set_tip(uicontact->tooltips, uicontact->button, tooltips_string, NULL); free(tooltips_string); - + /* Drag and Drop */ targets[0].target = "tm_username"; targets[0].flags = GTK_TARGET_SAME_APP; @@ -1308,9 +1308,9 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * /* Sort out the size of the new item */ gtk_widget_set_usize(uicontact->hbox, 10, -1); - + gtk_widget_show_all(uicontact->button); - + } /* Called from src/contactlist.c to add a contact (on the FL) to the list UI @@ -1318,7 +1318,7 @@ static void mainwindow_addcontactui(UIContact *uicontact, char *username, char * UIContact *mainwindow_addcontact(char *username, char *friendlyname, OnlineState status) { UIContact *uicontact; - + uicontact = malloc(sizeof(UIContact)); assert(uicontact != NULL); @@ -1329,9 +1329,9 @@ UIContact *mainwindow_addcontact(char *username, char *friendlyname, OnlineState uicontact->eventbox = NULL; uicontact->tooltips = NULL; uicontact->pixmap = NULL; - + mainwindow_addcontactui(uicontact, username, friendlyname, status); - + return uicontact; } @@ -1340,7 +1340,7 @@ UIContact *mainwindow_addcontact(char *username, char *friendlyname, OnlineState void mainwindow_setcontactstatus(UIContact *uicontact, char *username, char *friendlyname, OnlineState status) { debug_print("MA: Setting contact status for %s.\n", username); - mainwindow_removecontact(uicontact); + mainwindow_removecontact(uicontact); mainwindow_addcontactui(uicontact, username, friendlyname, status); } @@ -1366,7 +1366,7 @@ void mainwindow_removecontact(UIContact *uicontact) { uicontact->tooltips = NULL; uicontact->button = NULL; uicontact->pixmap = NULL; - + } /* Pass bits of information to src/pixmap.c so it can do its stuff */ -- cgit v1.2.3