Mercurial > pidgin.yaz
changeset 25527:0f53f60b2018
propagate from branch 'im.pidgin.pidgin' (head efa0e31922a07bb598a6fc8951462e1fa96a886e)
to branch 'im.pidgin.pidgin.yaz' (head 257f5893d67df3981961590fd624e09296a094f0)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 02 Jul 2007 11:26:17 +0000 |
parents | 162a767a20d4 (current diff) ec20ef0c2509 (diff) |
children | 9d16965bada4 |
files | libpurple/protocols/gg/lib/pubdir50.c pidgin/gtkdocklet.c pidgin/gtkprefs.c |
diffstat | 16 files changed, 156 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Jul 01 08:41:01 2007 +0000 +++ b/ChangeLog Mon Jul 02 11:26:17 2007 +0000 @@ -18,6 +18,10 @@ directory. The net effect of this is that trying to start Pidgin a second time will raise the buddy list. (Gabriel Schulhof) * Undo capability in the conversation window + * The formatting toolbar has been reorganized to be more concise. + * A new status area has been added to the top of conversations to + provide additional detail about the buddy, including buddy icon, + protocol and status message. Finch: * There's support for workspaces now (details in the manpage)
--- a/ChangeLog.API Sun Jul 01 08:41:01 2007 +0000 +++ b/ChangeLog.API Mon Jul 02 11:26:17 2007 +0000 @@ -102,11 +102,15 @@ gnt_text_view_set_flag * gnt_style_get_from_name * gnt_window_present + * gnt_tree_set_column_width_ratio + * gnt_tree_set_column_resizable Changed: * gnt_tree_get_rows() now returns a GList* instead of a const GList*, as const is not very useful with GLists. The returned value still must not be modified or freed. + * Instead of keeping an 'invisible' item, the GntTreeColumns now + maintain 'flags' with the appropriate flags set version 2.0.2 (6/14/2007): Pidgin:
--- a/finch/gntft.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/gntft.c Mon Jul 02 11:26:17 2007 +0000 @@ -178,6 +178,7 @@ GntWidget *button; GntWidget *checkbox; GntWidget *tree; + int widths[] = {8, 12, 8, 8, 8, 8, -1}; if (!xfer_dialog) xfer_dialog = g_new0(PurpleGntXferDialog, 1); @@ -195,12 +196,12 @@ xfer_dialog->tree = tree = gnt_tree_new_with_columns(NUM_COLUMNS); gnt_tree_set_column_titles(GNT_TREE(tree), _("Progress"), _("Filename"), _("Size"), _("Speed"), _("Remaining"), _("Status")); - gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_PROGRESS, 8); - gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_FILENAME, 8); - gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_SIZE, 10); - gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_SPEED, 10); - gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_REMAINING, 10); - gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_STATUS, 10); + gnt_tree_set_column_width_ratio(GNT_TREE(tree), widths); + gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_PROGRESS, FALSE); + gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_SIZE, FALSE); + gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_SPEED, FALSE); + gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_REMAINING, FALSE); + gnt_widget_set_size(tree, 70, -1); gnt_tree_set_show_title(GNT_TREE(tree), TRUE); gnt_box_add_widget(GNT_BOX(window), tree);
--- a/finch/gntprefs.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/gntprefs.c Mon Jul 02 11:26:17 2007 +0000 @@ -52,6 +52,10 @@ purple_prefs_add_none("/finch/conversations"); purple_prefs_add_bool("/finch/conversations/timestamps", TRUE); purple_prefs_add_bool("/finch/conversations/notify_typing", FALSE); + + purple_prefs_add_none("/finch/filelocations"); + purple_prefs_add_path("/finch/filelocations/last_save_folder", ""); + purple_prefs_add_path("/finch/filelocations/last_save_folder", ""); } void finch_prefs_update_old()
--- a/finch/gntrequest.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/gntrequest.c Mon Jul 02 11:26:17 2007 +0000 @@ -42,6 +42,7 @@ void *user_data; GntWidget *dialog; GCallback *cbs; + gboolean save; } PurpleGntFileRequest; static GntWidget * @@ -581,7 +582,7 @@ } static void -file_cancel_cb(GntWidget *wid, gpointer fq) +file_cancel_cb(gpointer fq, GntWidget *wid) { PurpleGntFileRequest *data = fq; if (data->cbs[1] != NULL) @@ -591,13 +592,17 @@ } static void -file_ok_cb(GntWidget *wid, gpointer fq) +file_ok_cb(gpointer fq, GntWidget *widget) { PurpleGntFileRequest *data = fq; char *file = gnt_file_sel_get_selected_file(GNT_FILE_SEL(data->dialog)); + char *dir = g_path_get_dirname(file); if (data->cbs[0] != NULL) ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); g_free(file); + purple_prefs_set_path(data->save ? "/finch/filelocations/last_save_folder" : + "/finch/filelocations/last_open_folder", dir); + g_free(dir); purple_request_close(PURPLE_REQUEST_FILE, data->dialog); } @@ -619,23 +624,34 @@ GntWidget *window = gnt_file_sel_new(); GntFileSel *sel = GNT_FILE_SEL(window); PurpleGntFileRequest *data = g_new0(PurpleGntFileRequest, 1); + const char *path; data->user_data = user_data; data->cbs = g_new0(GCallback, 2); data->cbs[0] = ok_cb; data->cbs[1] = cancel_cb; data->dialog = window; + data->save = savedialog; gnt_box_set_title(GNT_BOX(window), title ? title : (savedialog ? _("Save File...") : _("Open File..."))); - gnt_file_sel_set_current_location(sel, purple_home_dir()); /* XXX: */ + + path = purple_prefs_get_path(savedialog ? "/finch/filelocations/last_save_folder" : "/finch/filelocations/last_open_folder"); + gnt_file_sel_set_current_location(sel, (path && *path) ? path : purple_home_dir()); + if (savedialog) gnt_file_sel_set_suggested_filename(sel, filename); + g_signal_connect(G_OBJECT(sel->cancel), "activate", + G_CALLBACK(action_performed), window); + g_signal_connect(G_OBJECT(sel->select), "activate", + G_CALLBACK(action_performed), window); + g_signal_connect_swapped(G_OBJECT(sel->cancel), "activate", G_CALLBACK(file_cancel_cb), data); - g_signal_connect(G_OBJECT(sel->select), "activate", + g_signal_connect_swapped(G_OBJECT(sel->select), "activate", G_CALLBACK(file_ok_cb), data); - g_signal_connect_swapped(G_OBJECT(window), "destroy", - G_CALLBACK(file_request_destroy), data); + setup_default_callback(window, file_cancel_cb, data); + g_object_set_data_full(G_OBJECT(window), "filerequestdata", data, + (GDestroyNotify)file_request_destroy); gnt_widget_show(window); return window;
--- a/finch/gntstatus.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/gntstatus.c Mon Jul 02 11:26:17 2007 +0000 @@ -163,6 +163,7 @@ void finch_savedstatus_show_all() { GntWidget *window, *tree, *box, *button; + int widths[] = {25, 12, 35}; if (statuses.window) { gnt_window_present(statuses.window); return; @@ -179,9 +180,8 @@ statuses.tree = tree = gnt_tree_new_with_columns(3); gnt_tree_set_column_titles(GNT_TREE(tree), _("Title"), _("Type"), _("Message")); gnt_tree_set_show_title(GNT_TREE(tree), TRUE); - gnt_tree_set_col_width(GNT_TREE(tree), 0, 25); - gnt_tree_set_col_width(GNT_TREE(tree), 1, 12); - gnt_tree_set_col_width(GNT_TREE(tree), 2, 35); + gnt_tree_set_column_width_ratio(GNT_TREE(tree), widths); + gnt_widget_set_size(tree, 72, 0); gnt_box_add_widget(GNT_BOX(window), tree); populate_statuses(GNT_TREE(tree));
--- a/finch/libgnt/gntmenu.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/libgnt/gntmenu.c Mon Jul 02 11:26:17 2007 +0000 @@ -329,6 +329,7 @@ GNT_TREE(widget)->show_separator = FALSE; _gnt_tree_init_internals(GNT_TREE(widget), 2); gnt_tree_set_col_width(GNT_TREE(widget), 1, 1); /* The second column is to indicate that it has a submenu */ + gnt_tree_set_column_resizable(GNT_TREE(widget), 1, FALSE); GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER); }
--- a/finch/libgnt/gnttree.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/libgnt/gnttree.c Mon Jul 02 11:26:17 2007 +0000 @@ -31,6 +31,8 @@ #define SEARCH_TIMEOUT 4000 /* 4 secs */ #define SEARCHING(tree) (tree->search && tree->search->len > 0) +#define COLUMN_INVISIBLE(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_INVISIBLE) + enum { SIG_SELECTION_CHANGED, @@ -75,6 +77,36 @@ static GntWidgetClass *parent_class = NULL; static guint signals[SIGS] = { 0 }; +static void +readjust_columns(GntTree *tree) +{ + int i, col, total; + int width; +#define WIDTH(i) (tree->columns[i].width_ratio ? tree->columns[i].width_ratio : tree->columns[i].width) + gnt_widget_get_size(GNT_WIDGET(tree), &width, NULL); + for (i = 0, total = 0; i < tree->ncol ; i++) { + if (tree->columns[i].flags & GNT_TREE_COLUMN_INVISIBLE) + continue; + if (tree->columns[i].flags & GNT_TREE_COLUMN_FIXED_SIZE) + width -= WIDTH(i); + else + total += WIDTH(i); + } + + if (total == 0) + return; + + for (i = 0; i < tree->ncol; i++) { + if (tree->columns[i].flags & GNT_TREE_COLUMN_INVISIBLE) + continue; + if (tree->columns[i].flags & GNT_TREE_COLUMN_FIXED_SIZE) + col = WIDTH(i); + else + col = (WIDTH(i) * width) / total; + gnt_tree_set_col_width(GNT_TREE(tree), i, col); + } +} + /* Move the item at position old to position new */ static GList * g_list_reposition_child(GList *list, int old, int new) @@ -249,7 +281,7 @@ gboolean notfirst = FALSE; int lastvisible = tree->ncol; - while (lastvisible && tree->columns[lastvisible].invisible) + while (lastvisible && COLUMN_INVISIBLE(tree, lastvisible)) lastvisible--; for (i = 0, iter = row->columns; i < tree->ncol && iter; i++, iter = iter->next) @@ -261,7 +293,7 @@ gboolean cut = FALSE; int width; - if (tree->columns[i].invisible) + if (COLUMN_INVISIBLE(tree, i)) continue; if (i == lastvisible) @@ -335,11 +367,11 @@ for (i = 0; i < tree->ncol - 1; i++) { - if (!tree->columns[i].invisible) { + if (!COLUMN_INVISIBLE(tree, i)) { notfirst = TRUE; NEXT_X; } - if (!tree->columns[i+1].invisible && notfirst) + if (!COLUMN_INVISIBLE(tree, i+1) && notfirst) mvwaddch(widget->window, y, x, type); } } @@ -383,7 +415,7 @@ for (i = 0; i < tree->ncol; i++) { - if (tree->columns[i].invisible) { + if (COLUMN_INVISIBLE(tree, i)) { continue; } mvwaddstr(widget->window, pos, x + 1, tree->columns[i].title); @@ -555,7 +587,7 @@ GntTree *tree = GNT_TREE(widget); int i, width = 0; for (i = 0; i < tree->ncol; i++) - if (!tree->columns[i].invisible) + if (!COLUMN_INVISIBLE(tree, i)) width += tree->columns[i].width + 1; widget->priv.width = width; } @@ -829,16 +861,10 @@ gnt_tree_size_changed(GntWidget *widget, int w, int h) { GntTree *tree = GNT_TREE(widget); - int i; - int n = 0; if (widget->priv.width <= 0) return; - for (i = 0; i < tree->ncol; ++i) - n += tree->columns[i].width; - if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER)) - tree->columns[tree->ncol - 1].width += widget->priv.width - n - 1 * tree->ncol; - else - tree->columns[tree->ncol - 1].width += widget->priv.width - n - 2 - 1 * tree->ncol; + + readjust_columns(tree); } static gboolean @@ -1524,6 +1550,8 @@ g_return_if_fail(col < tree->ncol); tree->columns[col].width = width; + if (tree->columns[col].width_ratio == 0) + tree->columns[col].width_ratio = width; } void gnt_tree_set_column_title(GntTree *tree, int index, const char *title) @@ -1598,7 +1626,7 @@ twidth = 1 + 2 * (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_NO_BORDER)); for (i = 0; i < tree->ncol; i++) { gnt_tree_set_col_width(tree, i, widths[i]); - if (!tree->columns[i].invisible) + if (!COLUMN_INVISIBLE(tree, i)) twidth += widths[i] + (tree->show_separator ? 1 : 0) + 1; } g_free(widths); @@ -1613,9 +1641,32 @@ tree->hash = g_hash_table_new_full(hash, eq, kd, free_tree_row); } +static void +set_column_flag(GntTree *tree, int col, GntTreeColumnFlag flag, gboolean set) +{ + if (set) + tree->columns[col].flags |= flag; + else + tree->columns[col].flags &= ~flag; +} + void gnt_tree_set_column_visible(GntTree *tree, int col, gboolean vis) { g_return_if_fail(col < tree->ncol); - tree->columns[col].invisible = !vis; + set_column_flag(tree, col, GNT_TREE_COLUMN_INVISIBLE, !vis); +} + +void gnt_tree_set_column_resizable(GntTree *tree, int col, gboolean res) +{ + g_return_if_fail(col < tree->ncol); + set_column_flag(tree, col, GNT_TREE_COLUMN_FIXED_SIZE, !res); } +void gnt_tree_set_column_width_ratio(GntTree *tree, int cols[]) +{ + int i; + for (i = 0; i < tree->ncol && cols[i]; i++) { + tree->columns[i].width_ratio = cols[i]; + } +} +
--- a/finch/libgnt/gnttree.h Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/libgnt/gnttree.h Mon Jul 02 11:26:17 2007 +0000 @@ -40,10 +40,6 @@ #define GNT_IS_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TREE)) #define GNT_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TREE, GntTreeClass)) -#define GNT_TREE_FLAGS(obj) (GNT_TREE(obj)->priv.flags) -#define GNT_TREE_SET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) |= flags) -#define GNT_TREE_UNSET_FLAGS(obj, flags) (GNT_TREE_FLAGS(obj) &= ~(flags)) - typedef struct _GntTree GntTree; typedef struct _GntTreePriv GntTreePriv; typedef struct _GntTreeClass GntTreeClass; @@ -51,6 +47,11 @@ typedef struct _GntTreeRow GntTreeRow; typedef struct _GntTreeCol GntTreeCol; +typedef enum { + GNT_TREE_COLUMN_INVISIBLE = 1 << 0, + GNT_TREE_COLUMN_FIXED_SIZE = 1 << 1, +} GntTreeColumnFlag; + struct _GntTree { GntWidget parent; @@ -74,7 +75,8 @@ { int width; char *title; - gboolean invisible; + int width_ratio; + GntTreeColumnFlag flags; } *columns; /* Would a GList be better? */ gboolean show_title; gboolean show_separator; /* Whether to show column separators */ @@ -368,16 +370,39 @@ */ void gnt_tree_set_hash_fns(GntTree *tree, gpointer hash, gpointer eq, gpointer kd); -/* This can be useful when, for example, we want to store some data - * which we don't want/need to display. */ /** + * Set whether a column is visible or not. + * This can be useful when, for example, we want to store some data + * which we don't want/need to display. * - * @param tree - * @param col - * @param vis + * @param tree The tree + * @param col The index of the column + * @param vis If @c FALSE, the column will not be displayed */ void gnt_tree_set_column_visible(GntTree *tree, int col, gboolean vis); +/** + * Set whether a column can be resized to keep the same ratio when the + * tree is resized. + * + * @param tree The tree + * @param col The index of the column + * @param res If @c FALSE, the column will not be resized when the + * tree is resized + */ +void gnt_tree_set_column_resizable(GntTree *tree, int col, gboolean res); + +/** + * Set column widths to use when calculating column widths after a tree + * is resized. + * + * @param tree The tree + * @param cols Array of widths. The width must have the same number + * of entries as the number of columns in the tree, or + * end with a negative value for a column-width. + */ +void gnt_tree_set_column_width_ratio(GntTree *tree, int cols[]); + G_END_DECLS /* The following functions should NOT be used by applications. */
--- a/finch/libgnt/wms/irssi.c Sun Jul 01 08:41:01 2007 +0000 +++ b/finch/libgnt/wms/irssi.c Mon Jul 02 11:26:17 2007 +0000 @@ -126,7 +126,7 @@ int x, y, w, h; name = gnt_widget_get_name(win); - if (!name || strcmp(name, "conversation-window")) { + if (!name || !strstr(name, "conversation-window")) { if (!GNT_IS_MENU(win) && !GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_TRANSIENT)) { if ((!name || strcmp(name, "buddylist"))) { gnt_widget_get_size(win, &w, &h); @@ -191,7 +191,7 @@ { GntWidget *win = node->me; const char *name = gnt_widget_get_name(win); - if (!name || !GNT_IS_BOX(win) || strcmp(name, "conversation-window")) + if (!name || !GNT_IS_BOX(win) || !strstr(name, "conversation-window")) return; g_object_set_data(G_OBJECT(win), "irssi-index", GINT_TO_POINTER(g_list_index(wm->cws->list, win))); g_timeout_add(0, (GSourceFunc)update_conv_window_title, node);
--- a/libpurple/plugins/log_reader.c Sun Jul 01 08:41:01 2007 +0000 +++ b/libpurple/plugins/log_reader.c Mon Jul 02 11:26:17 2007 +0000 @@ -1924,7 +1924,7 @@ char *utf8_string; FILE *file; - + *flags = PURPLE_LOG_READ_NO_NEWLINE; g_return_val_if_fail(log != NULL, g_strdup("")); data = log->logger_data;
--- a/libpurple/protocols/gg/lib/http.c Sun Jul 01 08:41:01 2007 +0000 +++ b/libpurple/protocols/gg/lib/http.c Mon Jul 02 11:26:17 2007 +0000 @@ -349,7 +349,7 @@ gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-HEADER-----\n%s\n=> -----END-HTTP-HEADER-----\n", h->header); while (line) { - if (!g_ascii_strncasecmp(line, "Content-length: ", 16)) { + if (!strncasecmp(line, "Content-length: ", 16)) { h->body_size = atoi(line + 16); } line = strchr(line, '\n');
--- a/libpurple/protocols/gg/lib/pubdir50.c Sun Jul 01 08:41:01 2007 +0000 +++ b/libpurple/protocols/gg/lib/pubdir50.c Mon Jul 02 11:26:17 2007 +0000 @@ -348,7 +348,7 @@ /* jeśli dostaliśmy namier na następne wyniki, to znaczy że * mamy koniec wyników i nie jest to kolejna osoba. */ - if (!g_ascii_strcasecmp(field, "nextstart")) { + if (!strcasecmp(field, "nextstart")) { res->next = atoi(value); num--; } else { @@ -391,7 +391,7 @@ } for (i = 0; i < res->entries_count; i++) { - if (res->entries[i].num == num && !g_ascii_strcasecmp(res->entries[i].field, field)) { + if (res->entries[i].num == num && !strcasecmp(res->entries[i].field, field)) { value = res->entries[i].value; break; }
--- a/libpurple/protocols/qq/im.c Sun Jul 01 08:41:01 2007 +0000 +++ b/libpurple/protocols/qq/im.c Mon Jul 02 11:26:17 2007 +0000 @@ -573,7 +573,7 @@ read_packet_b(data, &cursor, len, &reply); if (reply != QQ_SEND_IM_REPLY_OK) { purple_debug(PURPLE_DEBUG_WARNING, "QQ", "Send IM fail\n"); - purple_notify_error(gc, _("Server ACK"), _("Send IM fail\n"), NULL); + purple_notify_error(gc, _("Server ACK"), _("Failed to send IM."), NULL); } else purple_debug(PURPLE_DEBUG_INFO, "QQ", "IM ACK OK\n");
--- a/pidgin/gtkdocklet.c Sun Jul 01 08:41:01 2007 +0000 +++ b/pidgin/gtkdocklet.c Mon Jul 02 11:26:17 2007 +0000 @@ -636,7 +636,7 @@ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/blink", FALSE); - purple_prefs_add_string(PIDGIN_PREFS_ROOT "/docklet/show", "always"); + purple_prefs_add_string(PIDGIN_PREFS_ROOT "/docklet/show", "pending"); purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", docklet_show_pref_changed_cb, NULL);
--- a/pidgin/gtkprefs.c Sun Jul 01 08:41:01 2007 +0000 +++ b/pidgin/gtkprefs.c Mon Jul 02 11:26:17 2007 +0000 @@ -640,7 +640,7 @@ static void add_theme_button_clicked_cb(GtkWidget *widget, gpointer null) { - purple_request_file(NULL, "Install Theme", NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL) ; + purple_request_file(NULL, _("Install Theme"), NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL) ; } static void