Mercurial > pidgin
changeset 19176:33201366bcd4
Fix some white-space and other similar issues. Preparing for a merge.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 11 Aug 2007 10:22:37 +0000 |
parents | c79177766e13 |
children | 19a4594e939c |
files | finch/libgnt/gntbindable.c finch/libgnt/gntmain.c finch/libgnt/gntstyle.c finch/libgnt/gntwm.c |
diffstat | 4 files changed, 56 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/libgnt/gntbindable.c Sat Aug 11 09:32:06 2007 +0000 +++ b/finch/libgnt/gntbindable.c Sat Aug 11 10:22:37 2007 +0000 @@ -37,13 +37,12 @@ static struct { - char * okeys; /* Old keystrokes */ - char * keys; /* New Keystrokes being bound to the action */ + char * okeys; /* Old keystrokes */ + char * keys; /* New Keystrokes being bound to the action */ GntBindableClass * klass; /* Class of the object that's getting keys rebound */ - char * name; /* The name of the action */ - GList * params; /* The list of paramaters */ - -} rebind_info = {NULL,NULL,NULL,NULL,NULL}; + char * name; /* The name of the action */ + GList * params; /* The list of paramaters */ +} rebind_info; static void gnt_bindable_free_rebind_info() @@ -63,8 +62,7 @@ static void gnt_bindable_rebinding_rebind(GntWidget *button, gpointer data) { - - if(rebind_info.keys) { + if (rebind_info.keys) { gnt_bindable_register_binding(rebind_info.klass, NULL, rebind_info.okeys, @@ -75,34 +73,31 @@ rebind_info.params); } gnt_bindable_free_rebind_info(); - gnt_widget_destroy(GNT_WIDGET(data)); } static gboolean -gnt_bindable_rebinding_grab_key(GntBindable *bindable, const char *text, gpointer *data) +gnt_bindable_rebinding_grab_key(GntBindable *bindable, const char *text, gpointer data) { - - GntTextView *textview= GNT_TEXT_VIEW(data); + GntTextView *textview = GNT_TEXT_VIEW(data); char *new_text; const char *tmp; - if(text && *text){ - - if(!strcmp(text, GNT_KEY_CTRL_I) || !strcmp(text, GNT_KEY_ENTER)){ + if (text && *text) { + /* Rebinding tab or enter for something is probably not that great an idea */ + if (!strcmp(text, GNT_KEY_CTRL_I) || !strcmp(text, GNT_KEY_ENTER)) { return FALSE; } tmp = gnt_key_lookup(text); - new_text = g_strdup_printf("KEY: \"%s\"",tmp); + new_text = g_strdup_printf("KEY: \"%s\"", tmp); gnt_text_view_clear(textview); - gnt_text_view_append_text_with_flags(textview,new_text,GNT_TEXT_FLAG_NORMAL); + gnt_text_view_append_text_with_flags(textview, new_text, GNT_TEXT_FLAG_NORMAL); g_free(new_text); g_free(rebind_info.keys); rebind_info.keys = g_strdup(text); - return TRUE; } return FALSE; @@ -110,82 +105,71 @@ static void gnt_bindable_rebinding_activate(GntBindable *data, gpointer bindable) { - - GntTree * tree = GNT_TREE(data); - - GntWidget *vbox = gnt_box_new(FALSE,TRUE); - + const char *widget_name = g_type_name(G_OBJECT_TYPE(bindable)); + char *keys; + GntWidget *key_textview; GntWidget *label; - const char * widget_name = g_type_name(G_OBJECT_TYPE(bindable)); - char * keys; - - GntWidget *key_textview; - GntWidget *bind_button, *cancel_button; GntWidget *button_box; - + GList *current_row_data, *itr; + char *tmp; GntWidget *win = gnt_window_new(); - GList * current_row_data,*itr; - char * tmp; + GntTree *tree = GNT_TREE(data); + GntWidget *vbox = gnt_box_new(FALSE, TRUE); rebind_info.klass = GNT_BINDABLE_GET_CLASS(bindable); current_row_data = gnt_tree_get_selection_text_list(tree); - rebind_info.name = g_strdup(g_list_nth_data(current_row_data,1)); + rebind_info.name = g_strdup(g_list_nth_data(current_row_data, 1)); keys = gnt_tree_get_selection_data(tree); rebind_info.okeys = g_strdup(gnt_key_translate(keys)); rebind_info.params = NULL; - itr = current_row_data; - while(itr){ - g_free(itr->data); - itr = itr->next; - } + g_list_foreach(current_row_data, (GFunc)g_free, NULL); g_list_free(current_row_data); gnt_box_set_alignment(GNT_BOX(vbox), GNT_ALIGN_MID); - gnt_box_set_title(GNT_BOX(win),"Key Capture"); + gnt_box_set_title(GNT_BOX(win), "Key Capture"); - tmp = g_strdup_printf("Type the new bindings for %s in a %s.",rebind_info.name,widget_name); + tmp = g_strdup_printf("Type the new bindings for %s in a %s.", rebind_info.name, widget_name); label = gnt_label_new(tmp); g_free(tmp); - gnt_box_add_widget(GNT_BOX(vbox),label); + gnt_box_add_widget(GNT_BOX(vbox), label); - tmp = g_strdup_printf("KEY: \"%s\"",keys); + tmp = g_strdup_printf("KEY: \"%s\"", keys); key_textview = gnt_text_view_new(); - gnt_widget_set_size(key_textview,key_textview->priv.x,2); - gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(key_textview),tmp,GNT_TEXT_FLAG_NORMAL); + gnt_widget_set_size(key_textview, key_textview->priv.x, 2); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(key_textview), tmp, GNT_TEXT_FLAG_NORMAL); g_free(tmp); - gnt_widget_set_name(key_textview,"keystroke"); - gnt_box_add_widget(GNT_BOX(vbox),key_textview); + gnt_widget_set_name(key_textview, "keystroke"); + gnt_box_add_widget(GNT_BOX(vbox), key_textview); - g_signal_connect(G_OBJECT(win), "key_pressed", G_CALLBACK(gnt_bindable_rebinding_grab_key),key_textview); + g_signal_connect(G_OBJECT(win), "key_pressed", G_CALLBACK(gnt_bindable_rebinding_grab_key), key_textview); - button_box = gnt_box_new(FALSE,FALSE); + button_box = gnt_box_new(FALSE, FALSE); bind_button = gnt_button_new("BIND"); - gnt_widget_set_name(bind_button,"bind"); + gnt_widget_set_name(bind_button, "bind"); gnt_box_add_widget(GNT_BOX(button_box), bind_button); cancel_button = gnt_button_new("Cancel"); - gnt_widget_set_name(cancel_button,"cancel"); - gnt_box_add_widget(GNT_BOX(button_box),cancel_button); - - g_signal_connect(G_OBJECT(bind_button), "activate", G_CALLBACK(gnt_bindable_rebinding_rebind),win); - g_signal_connect(G_OBJECT(cancel_button), "activate", G_CALLBACK(gnt_bindable_rebinding_cancel),win); + gnt_widget_set_name(cancel_button, "cancel"); + gnt_box_add_widget(GNT_BOX(button_box), cancel_button); - - gnt_box_add_widget(GNT_BOX(vbox),button_box); + g_signal_connect(G_OBJECT(bind_button), "activate", G_CALLBACK(gnt_bindable_rebinding_rebind), win); + g_signal_connect(G_OBJECT(cancel_button), "activate", G_CALLBACK(gnt_bindable_rebinding_cancel), win); + + gnt_box_add_widget(GNT_BOX(vbox), button_box); - gnt_box_add_widget(GNT_BOX(win),vbox); + gnt_box_add_widget(GNT_BOX(win), vbox); gnt_widget_show(win); - } -typedef struct { +typedef struct +{ GHashTable *hash; GntTree *tree; } BindingView; @@ -273,7 +257,7 @@ { static GType type = 0; - if(type == 0) { + if (type == 0) { static const GTypeInfo info = { sizeof(GntBindableClass), (GBaseInitFunc)duplicate_hashes, /* base_init */
--- a/finch/libgnt/gntmain.c Sat Aug 11 09:32:06 2007 +0000 +++ b/finch/libgnt/gntmain.c Sat Aug 11 10:22:37 2007 +0000 @@ -252,12 +252,18 @@ if (HOLDING_ESCAPE) keys[0] = '\033'; k = keys; - if(*k < 0){ /* Alt not sending ESC* */ + +#if 0 + /* I am not sure what's happening here. If this actually does something, + * then this needs to go in gnt_keys_refine. */ + if (*k < 0) { /* Alt not sending ESC* */ *(k + 1) = 128 - *k; *k = 27; *(k + 2) = 0; rd++; } +#endif + while (rd) { char back; int p;
--- a/finch/libgnt/gntstyle.c Sat Aug 11 09:32:06 2007 +0000 +++ b/finch/libgnt/gntstyle.c Sat Aug 11 10:22:37 2007 +0000 @@ -22,7 +22,6 @@ #include "gntstyle.h" #include "gntcolors.h" - #include "gntws.h" #include <glib.h>
--- a/finch/libgnt/gntwm.c Sat Aug 11 09:32:06 2007 +0000 +++ b/finch/libgnt/gntwm.c Sat Aug 11 10:22:37 2007 +0000 @@ -34,13 +34,13 @@ #include <string.h> #include <time.h> -#include "gntbutton.h" #include "gntwm.h" -#include "gntentry.h" #include "gntstyle.h" #include "gntmarshal.h" #include "gnt.h" #include "gntbox.h" +#include "gntbutton.h" +#include "gntentry.h" #include "gntlabel.h" #include "gntmenu.h" #include "gnttextview.h" @@ -736,7 +736,6 @@ print = ch; #ifndef NO_WIDECHAR if (wch.chars[0] > 255) { - /* XXX This lines throws a warning, can we quiet it? */ snprintf(unicode, sizeof(unicode), "&#x%x;", wch.chars[0]); print = unicode; } @@ -1142,7 +1141,6 @@ ret = gnt_bindable_build_help_window(bindable); } return ret; - } static gboolean @@ -1156,11 +1154,10 @@ { GntWM *wm = GNT_WM(bindable); GntWidget *widget; - - + if(!wm->cws->ordered) return FALSE; - + widget = wm->cws->ordered->data; return help_for_bindable(wm,GNT_BINDABLE(widget)); @@ -1180,7 +1177,6 @@ return TRUE; return help_for_bindable(wm, GNT_BINDABLE(GNT_BOX(widget)->active)); - } static void @@ -1338,14 +1334,12 @@ "\033" "T", NULL); gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "workspace-list", workspace_list, "\033" "s", NULL); - gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", - toggle_clipboard, "\033" "C", NULL); + gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", toggle_clipboard, + "\033" "C", NULL); gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-wm", help_for_wm, "\033" "\\", NULL); gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "help-for-window", help_for_window, "\033" "|", NULL); - gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "toggle-clipboard", toggle_clipboard, - "\033" "C", NULL); gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-start", ignore_keys_start, GNT_KEY_CTRL_G, NULL); gnt_bindable_class_register_action(GNT_BINDABLE_CLASS(klass), "ignore-keys-end", ignore_keys_end, @@ -1963,7 +1957,6 @@ if (!node) return; - /* XXX Should there be a check before access to 'data' to make sure 'ordered' isn't NULL? */ if (widget != wm->_list.window && !GNT_IS_MENU(widget) && wm->cws->ordered->data != widget) { GntWidget *w = wm->cws->ordered->data; @@ -2028,7 +2021,6 @@ GntWS *ws = gnt_wm_widget_find_workspace(wm, widget); if (wm->cws != ws) gnt_wm_switch_workspace(wm, g_list_index(wm->workspaces, ws)); - /* XXX Should there be a check before access to 'data' to make sure 'ordered' isn't NULL? */ if (widget != wm->cws->ordered->data) { GntWidget *wid = wm->cws->ordered->data; wm->cws->ordered = g_list_bring_to_front(wm->cws->ordered, widget);