From: <ev...@us...> - 2006-08-19 01:19:42
|
Revision: 16857 Author: evands Date: 2006-08-18 18:19:33 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16857&view=rev Log Message: ----------- ** Part 2 of a 4 part commit ** Restructured the tree and the build files for the core/UI split. libgaim is now built as a library against which gtkgaim and gntgaim link and can be built separately from them by configuring with them disable d (--disable-gtkgaim and --disable-gntgaim). Each of the three source trees (gtk, console, and core) has its own plugins folder. This works nicely on my system; hopefully it won't cause too much chaos for others. If you have local changes, an easy way to merge them to the new layout should be along the lines of svn diff -r version_before_move > myChanges.diff patch -p1 < myChanges.diff where svn diff is done from the gaim checkout root but patch is done from gtk or core (or both). This changeset combines work by Sadrul Chowdhury, Gary Kramlich (grim), and me. Known issues: * On my system, at least, something's not quite right with the gtkgaim build process; it imports gtkgaim.h (as can be seen by adding a #warning) but <gtk/gtk.h> doesn't seem to be used. The GTK_STOCK_XXX defines claim to be undeclared. I was going to make this work before committing, but I strongly suspect someone with more autotools experience will be able to fix it easily whereas I've already glared at it for an hour. * The gnt console UI depends on libgnt, which is not yet automatically built. Either autogen.sh && make && make install libgnt (in console/libgnt) or configure with --disable-gnt for now. * The Windows build process has not been touched yet so still needs updating. * There's an stray "rm: core: is a directory" warning after autogen.sh is compl te. I'm not sure where that's coming from. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/gntgaim.c Added Paths: ----------- trunk/console/Makefile.am trunk/console/getopt.c trunk/console/getopt.h trunk/console/getopt1.c Removed Paths: ------------- trunk/console/Makefile Property Changed: ---------------- trunk/console/gntnotify.c trunk/console/gntnotify.h Deleted: trunk/console/Makefile =================================================================== --- trunk/console/Makefile 2006-08-19 01:13:25 UTC (rev 16856) +++ trunk/console/Makefile 2006-08-19 01:19:33 UTC (rev 16857) @@ -1,59 +0,0 @@ -VERSION=gntgaim-0.0.0dev -CC=gcc -CFLAGS=`pkg-config --cflags gaim gobject-2.0 gnt` -g -Wall -DVERSION=\"$(VERSION)\" -DSTANDALONE -LDFLAGS=`pkg-config --libs gaim gobject-2.0 libxml-2.0 gnt` -pg -lgaim - -GG_SOURCES = \ - gntaccount.c \ - gntblist.c \ - gntconn.c \ - gntconv.c \ - gntdebug.c \ - gntnotify.c \ - gntplugin.c \ - gntprefs.c \ - gntrequest.c \ - gntstatus.c \ - gntui.c - -GG_HEADERS = \ - gntaccount.h \ - gntblist.h \ - gntconn.h \ - gntconv.h \ - gntdebug.h \ - gntnotify.h \ - gntprefs.h \ - gntplugin.h \ - gntrequest.h \ - gntstatus.h \ - gntui.h - -GG_OBJECTS = \ - gntaccount.o \ - gntblist.o \ - gntconn.o \ - gntconv.o \ - gntdebug.o \ - gntnotify.o \ - gntplugin.o \ - gntprefs.o \ - gntrequest.o \ - gntstatus.o \ - gntui.o - -all: gntgaim - -gntgaim: gntgaim.o $(GG_OBJECTS) - $(CC) -o gntgaim gntgaim.o $(GG_OBJECTS) $(LDFLAGS) -gntaccount.o: gntaccount.c $(GG_HEADERS) -gntblist.o: gntblist.c $(GG_HEADERS) -gntconv.o: gntconv.c $(GG_HEADERS) -gntgaim.o: gntgaim.c gntgaim.h $(GG_HEADERS) -gntnotify.o: gntnotify.c $(GG_HEADERS) -gntui.o: gntui.c $(GG_HEADERS) - -clean: - rm -f *.o - rm -f gntgaim - Added: trunk/console/Makefile.am =================================================================== --- trunk/console/Makefile.am (rev 0) +++ trunk/console/Makefile.am 2006-08-19 01:19:33 UTC (rev 16857) @@ -0,0 +1,65 @@ +#libgnt currently needs to have autogen run for there to be a Makefile... +# SUBDIRS = libgnt + +bin_PROGRAMS = gntgaim + +gntgaim_SOURCES = \ + gntaccount.c \ + gntblist.c \ + gntconn.c \ + gntconv.c \ + gntdebug.c \ + gntgaim.c \ + gntnotify.c \ + gntplugin.c \ + gntprefs.c \ + gntrequest.c \ + gntstatus.c \ + gntui.c + +gntgaim_headers = \ + gntaccount.h \ + gntblist.h \ + gntconn.h \ + gntconv.h \ + gntdebug.h \ + gntnotify.h \ + gntplugin.c \ + gntprefs.h \ + gntrequest.h \ + gntstatus.h \ + gntui.h + +gntgaimincludedir=$(includedir)/gaim/gnt +gntgaiminclude_HEADERS = \ + $(gntgaim_headers) + +gntgaim_DEPENDENCIES = @LIBOBJS@ $(STATIC_LINK_LIBS) $(MS_LIBS) +gntgaim_LDFLAGS = -export-dynamic +gntgaim_LDADD = \ + @LIBOBJS@ \ + $(DBUS_LIBS) \ + $(GSTREAMER_LIBS) \ + $(STATIC_LINK_LIBS) \ + $(XSS_LIBS) \ + $(SM_LIBS) \ + $(INTLLIBS) \ + $(GLIB_LIBS) \ + $(LIBXML_LIBS) \ + -L./libgnt/ -lgnt \ + -L$(top_srcdir)/core -lgaim + +AM_CPPFLAGS = \ + -DSTANDALONE \ + -DBR_PTHREADS=0 \ + -DDATADIR=\"$(datadir)\" \ + -DLIBDIR=\"$(libdir)/gaim/\" \ + -DLOCALEDIR=\"$(datadir)/locale\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" \ + -I$(top_srcdir)/core/ \ + -I ./libgnt/ \ + $(GSTREAMER_CFLAGS) \ + $(DEBUG_CFLAGS) \ + $(GLIB_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(LIBXML_CFLAGS) Property changes on: trunk/console/Makefile.am ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Copied: trunk/console/getopt.c (from rev 16843, trunk/src/getopt.c) =================================================================== --- trunk/console/getopt.c (rev 0) +++ trunk/console/getopt.c 2006-08-19 01:19:33 UTC (rev 16857) @@ -0,0 +1,737 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to ro...@gn... + before changing it! + + Gaim is the legal property of its developers, whose names are too numerous + to list here. Please refer to the COPYRIGHT file distributed with this + source distribution. + + This program 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; either version 2, or (at your option) any + later version. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* NOTE!!! AIX requires this to be the first thing in the file. + Do not put ANYTHING before it! */ +#if !defined (__GNUC__) && defined (_AIX) + #pragma alloca +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* Alver says we need this for IRIX. */ +#if HAVE_STRING_H +#include "string.h" +#endif + +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else /* not __GNUC__ */ +#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) +#include <alloca.h> +#else +#ifndef _AIX +char *alloca (); +#endif +#endif /* alloca.h */ +#endif /* not __GNUC__ */ + +#if !__STDC__ && !defined(const) && IN_GCC +#define const +#endif + +/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#undef alloca +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include <stdlib.h> +#else /* Not GNU C library. */ +#define __alloca alloca +#endif /* GNU C library. */ + +/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a + long-named option. Because this is not POSIX.2 compliant, it is + being phased out. */ +/* #define GETOPT_COMPAT */ + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = 0; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include <string.h> +#define my_index strchr +#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +static void +my_bcopy (from, to, size) + const char *from; + char *to; + int size; +{ + int i; + for (i = 0; i < size; i++) + to[i] = from[i]; +} +#endif /* GNU C library. */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +static void +exchange (argv) + char **argv; +{ + int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); + char **temp = (char **) __alloca (nonopts_size); + + /* Interchange the two blocks of data in ARGV. */ + + my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); + my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], + (optind - last_nonopt) * sizeof (char *)); + my_bcopy ((char *) temp, + (char *) &argv[first_nonopt + optind - last_nonopt], + nonopts_size); + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + int option_index; + + optarg = 0; + + /* Initialize the internal data when the first call is made. + Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + if (optind == 0) + { + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (getenv ("POSIXLY_CORRECT") != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + } + + if (nextchar == NULL || *nextchar == '\0') + { + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Now skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc + && (argv[optind][0] != '-' || argv[optind][1] == '\0') +#ifdef GETOPT_COMPAT + && (longopts == NULL + || argv[optind][0] != '+' || argv[optind][1] == '\0') +#endif /* GETOPT_COMPAT */ + ) + optind++; + last_nonopt = optind; + } + + /* Special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if ((argv[optind][0] != '-' || argv[optind][1] == '\0') +#ifdef GETOPT_COMPAT + && (longopts == NULL + || argv[optind][0] != '+' || argv[optind][1] == '\0') +#endif /* GETOPT_COMPAT */ + ) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Start decoding its characters. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + if (longopts != NULL + && ((argv[optind][0] == '-' + && (argv[optind][1] == '-' || long_only)) +#ifdef GETOPT_COMPAT + || argv[optind][0] == '+' +#endif /* GETOPT_COMPAT */ + )) + { + const struct option *p; + char *s = nextchar; + int exact = 0; + int ambig = 0; + const struct option *pfound = NULL; + int indfound; + + while (*s && *s != '=') + s++; + + /* Test all options for either exact match or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; + p++, option_index++) + if (!strncmp (p->name, nextchar, s - nextchar)) + { + if (s - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, "%s: option `%s' is ambiguous\n", + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*s) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = s + 1; + else + { + if (opterr) + { + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + "%s: option `--%s' doesn't allow an argument\n", + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + "%s: option `%c%s' doesn't allow an argument\n", + argv[0], argv[optind - 1][0], pfound->name); + } + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, "%s: option `%s' requires an argument\n", + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' +#ifdef GETOPT_COMPAT + || argv[optind][0] == '+' +#endif /* GETOPT_COMPAT */ + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, "%s: unrecognized option `--%s'\n", + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, "%s: unrecognized option `%c%s'\n", + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + return '?'; + } + } + + /* Look at and handle the next option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { +#if 0 + if (c < 040 || c >= 0177) + fprintf (stderr, "%s: unrecognized option, character code 0%o\n", + argv[0], c); + else + fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); +#endif + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = 0; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { +#if 0 + fprintf (stderr, "%s: option `-%c' requires an argument\n", + argv[0], c); +#else + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, "%s: option requires an argument -- %c\n", + argv[0], c); +#endif + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ Property changes on: trunk/console/getopt.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Copied: trunk/console/getopt.h (from rev 16843, trunk/src/getopt.h) =================================================================== --- trunk/console/getopt.h (rev 0) +++ trunk/console/getopt.h 2006-08-19 01:19:33 UTC (rev 16857) @@ -0,0 +1,136 @@ +/* Declarations for getopt. + + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to ro...@gn... + before changing it! + + Gaim is the legal property of its developers, whose names are too numerous + to list here. Please refer to the COPYRIGHT file distributed with this + source distribution. + + This program 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; either version 2, or (at your option) any + later version. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if __STDC__ +#if defined(__GNU_LIBRARY__) +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* not __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* not __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ Property changes on: trunk/console/getopt.h ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Copied: trunk/console/getopt1.c (from rev 16843, trunk/src/getopt1.c) =================================================================== --- trunk/console/getopt1.c (rev 0) +++ trunk/console/getopt1.c 2006-08-19 01:19:33 UTC (rev 16857) @@ -0,0 +1,177 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Gaim is the legal property of its developers, whose names are too numerous + to list here. Please refer to the COPYRIGHT file distributed with this + source distribution. + + This program 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; either version 2, or (at your option) any + later version. + + This program 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. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "getopt.h" + +#if !__STDC__ && !defined(const) && IN_GCC +#define const +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include <stdlib.h> +#else +char *getenv (); +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +#include <stdio.h> + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == EOF) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ Property changes on: trunk/console/getopt1.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-19 01:13:25 UTC (rev 16856) +++ trunk/console/gntconv.c 2006-08-19 01:19:33 UTC (rev 16857) @@ -20,6 +20,8 @@ #define PREF_ROOT "/gaim/gnt/conversations" +#include "config.h" + GHashTable *ggconvs; typedef struct _GGConv GGConv; Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-19 01:13:25 UTC (rev 16856) +++ trunk/console/gntgaim.c 2006-08-19 01:19:33 UTC (rev 16857) @@ -23,6 +23,8 @@ #define _GNU_SOURCE #include <getopt.h> +#include "config.h" + static void debug_init() { Property changes on: trunk/console/gntnotify.c ___________________________________________________________________ Name: svn:mime-type - text/plan + text/plain Property changes on: trunk/console/gntnotify.h ___________________________________________________________________ Name: svn:mime-type - text/plan + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ev...@us...> - 2006-08-19 01:37:34
|
Revision: 16862 Author: evands Date: 2006-08-18 18:37:26 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16862&view=rev Log Message: ----------- Some more svn:ignore fixes Property Changed: ---------------- trunk/console/ trunk/console/libgnt/ trunk/console/plugins/ Property changes on: trunk/console ___________________________________________________________________ Name: svn:ignore + Makefile.in gmon.out .libs .deps Makefile .error Property changes on: trunk/console/libgnt ___________________________________________________________________ Name: svn:ignore + Makefile.in .deps .libs Property changes on: trunk/console/plugins ___________________________________________________________________ Name: svn:ignore + Makefile.in .deps Makefile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-19 03:38:35
|
Revision: 16870 Author: sadrul Date: 2006-08-18 20:38:23 -0700 (Fri, 18 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16870&view=rev Log Message: ----------- Do the right thing: remove the compile warnings. Modified Paths: -------------- trunk/console/gntaccount.h trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntconn.h trunk/console/gntconv.h trunk/console/gntdebug.h trunk/console/gntgaim.c trunk/console/gntgaim.h trunk/console/gntnotify.c trunk/console/gntnotify.h trunk/console/gntplugin.h trunk/console/gntprefs.c trunk/console/gntprefs.h trunk/console/gntrequest.c trunk/console/gntrequest.h trunk/console/gntstatus.h trunk/console/gntui.h trunk/console/libgnt/gntwidget.h Modified: trunk/console/gntaccount.h =================================================================== --- trunk/console/gntaccount.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntaccount.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,10 +1,14 @@ +#ifndef _GNT_ACCOUNT_H +#define _GNT_ACCOUNT_H + #include "account.h" -GaimAccountUiOps *gg_accounts_get_ui_ops(); +GaimAccountUiOps *gg_accounts_get_ui_ops(void); -void gg_accounts_init(); +void gg_accounts_init(void); -void gg_accounts_uninit(); +void gg_accounts_uninit(void); -void gg_accounts_show_all(); +void gg_accounts_show_all(void); +#endif Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntblist.c 2006-08-19 03:38:23 UTC (rev 16870) @@ -672,8 +672,8 @@ static void gg_blist_remove_node_cb(GaimBlistNode *node, GaimBlistNode *null) { - char *primary, *sec = NULL; - const char *name; + char *primary; + const char *name, *sec = NULL; if (GAIM_BLIST_NODE_IS_BUDDY(node)) name = gaim_buddy_get_name((GaimBuddy*)node); Modified: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntblist.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,12 +1,15 @@ +#ifndef _GNT_BLIST_H +#define _GNT_BLIST_H + #include "blist.h" -GaimBlistUiOps * gg_blist_get_ui_ops(); +GaimBlistUiOps * gg_blist_get_ui_ops(void); -void gg_blist_init(); +void gg_blist_init(void); -void gg_blist_uninit(); +void gg_blist_uninit(void); -void gg_blist_show(); +void gg_blist_show(void); void gg_blist_get_position(int *x, int *y); @@ -16,3 +19,4 @@ void gg_blist_set_size(int width, int height); +#endif Modified: trunk/console/gntconn.h =================================================================== --- trunk/console/gntconn.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntconn.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,8 +1,12 @@ +#ifndef _GNT_CONN_H +#define _GNT_CONN_H + #include "connection.h" -GaimConnectionUiOps *gg_connections_get_ui_ops(); +GaimConnectionUiOps *gg_connections_get_ui_ops(void); -void gg_connections_init(); +void gg_connections_init(void); -void gg_connections_uninit(); +void gg_connections_uninit(void); +#endif Modified: trunk/console/gntconv.h =================================================================== --- trunk/console/gntconv.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntconv.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,7 +1,12 @@ +#ifndef _GNT_CONV_H +#define _GNT_CONV_H + #include "conversation.h" -GaimConversationUiOps *gg_conv_get_ui_ops(); +GaimConversationUiOps *gg_conv_get_ui_ops(void); -void gg_conversation_init(); +void gg_conversation_init(void); -void gg_conversation_uninit(); +void gg_conversation_uninit(void); + +#endif Modified: trunk/console/gntdebug.h =================================================================== --- trunk/console/gntdebug.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntdebug.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,9 +1,14 @@ +#ifndef _GNT_DEBUG_H +#define _GNT_DEBUG_H + #include "debug.h" -GaimDebugUiOps *gg_debug_get_ui_ops(); +GaimDebugUiOps *gg_debug_get_ui_ops(void); -void gg_debug_init(); +void gg_debug_init(void); -void gg_debug_uninit(); +void gg_debug_uninit(void); -void gg_debug_window_show(); +void gg_debug_window_show(void); + +#endif Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntgaim.c 2006-08-19 03:38:23 UTC (rev 16870) @@ -129,7 +129,7 @@ (guint (*)(guint))g_source_remove }; -GaimEventLoopUiOps * +static GaimEventLoopUiOps * gnt_eventloop_get_ui_ops(void) { return &eventloop_ops; Modified: trunk/console/gntgaim.h =================================================================== --- trunk/console/gntgaim.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntgaim.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,6 +1,6 @@ #include <glib.h> -#include <libintl.h> +#include "libgaim/internal.h" + #define GAIM_GNT_UI "gnt-gaim" -#define _(x) x Modified: trunk/console/gntnotify.c =================================================================== --- trunk/console/gntnotify.c 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntnotify.c 2006-08-19 03:38:23 UTC (rev 16870) @@ -293,6 +293,8 @@ case GAIM_NOTIFY_BUTTON_INVITE: text = _("Invite"); break; + default: + text = _("(none)"); } button = gnt_button_new(text); Modified: trunk/console/gntnotify.h =================================================================== --- trunk/console/gntnotify.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntnotify.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,8 +1,13 @@ +#ifndef _GNT_NOTIFY_H +#define _GNT_NOTIFY_H + #include "notify.h" -GaimNotifyUiOps *gg_notify_get_ui_ops(); +GaimNotifyUiOps *gg_notify_get_ui_ops(void); -void gg_notify_init(); +void gg_notify_init(void); -void gg_notify_uninit(); +void gg_notify_uninit(void); +#endif + Modified: trunk/console/gntplugin.h =================================================================== --- trunk/console/gntplugin.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntplugin.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,3 +1,6 @@ +#ifndef _GNT_PLUGIN_H +#define _GNT_PLUGIN_H + #include <gnt.h> #include <plugin.h> @@ -16,7 +19,8 @@ #define GAIM_GNT_PLUGIN_UI_INFO(plugin) \ (GGPluginFrame)((plugin)->info->ui_info) -void gg_plugins_show_all(); +void gg_plugins_show_all(void); -void gg_plugins_save_loaded(); +void gg_plugins_save_loaded(void); +#endif Modified: trunk/console/gntprefs.c =================================================================== --- trunk/console/gntprefs.c 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntprefs.c 2006-08-19 03:38:23 UTC (rev 16870) @@ -46,15 +46,15 @@ switch (prefs->type) { case GAIM_PREF_BOOLEAN: - field = gaim_request_field_bool_new(prefs->pref, prefs->label, + field = gaim_request_field_bool_new(prefs->pref, _(prefs->label), gaim_prefs_get_bool(prefs->pref)); break; case GAIM_PREF_INT: - field = gaim_request_field_int_new(prefs->pref, prefs->label, + field = gaim_request_field_int_new(prefs->pref, _(prefs->label), gaim_prefs_get_int(prefs->pref)); break; case GAIM_PREF_STRING: - field = gaim_request_field_string_new(prefs->pref, prefs->label, + field = gaim_request_field_string_new(prefs->pref, _(prefs->label), gaim_prefs_get_string(prefs->pref), FALSE); break; default: @@ -64,7 +64,7 @@ else { GList *list = prefs->lv(), *iter; - field = gaim_request_field_list_new(prefs->pref, prefs->label); + field = gaim_request_field_list_new(prefs->pref, _(prefs->label)); for (iter = list; iter; iter = iter->next) { gboolean select = FALSE; @@ -98,23 +98,23 @@ static Prefs blist[] = { - {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", _("Show Idle Time"), NULL}, + {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", N_("Show Idle Time"), NULL}, {GAIM_PREF_NONE, NULL, NULL, NULL} }; static Prefs convs[] = { - {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/timestamps", _("Show Timestamps"), NULL}, - {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/notify_typing", _("Notify buddies when you are typing"), NULL}, + {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/timestamps", N_("Show Timestamps"), NULL}, + {GAIM_PREF_BOOLEAN, "/gaim/gnt/conversations/notify_typing", N_("Notify buddies when you are typing"), NULL}, {GAIM_PREF_NONE, NULL, NULL, NULL} }; static Prefs logging[] = { - {GAIM_PREF_STRING, "/core/logging/format", _("Log format"), get_log_options}, - {GAIM_PREF_BOOLEAN, "/core/logging/log_ims", _("Log IMs"), NULL}, - {GAIM_PREF_BOOLEAN, "/core/logging/log_chats", _("Log chats"), NULL}, - {GAIM_PREF_BOOLEAN, "/core/logging/log_system", _("Log status change events"), NULL}, + {GAIM_PREF_STRING, "/core/logging/format", N_("Log format"), get_log_options}, + {GAIM_PREF_BOOLEAN, "/core/logging/log_ims", N_("Log IMs"), NULL}, + {GAIM_PREF_BOOLEAN, "/core/logging/log_chats", N_("Log chats"), NULL}, + {GAIM_PREF_BOOLEAN, "/core/logging/log_system", N_("Log status change events"), NULL}, {GAIM_PREF_NONE, NULL, NULL, NULL}, }; Modified: trunk/console/gntprefs.h =================================================================== --- trunk/console/gntprefs.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntprefs.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,4 +1,8 @@ -void gg_prefs_init(); +#ifndef _GNT_PREFS_H +#define _GNT_PREFS_H -void gg_prefs_show_all(); +void gg_prefs_init(void); +void gg_prefs_show_all(void); + +#endif Modified: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntrequest.c 2006-08-19 03:38:23 UTC (rev 16870) @@ -247,7 +247,8 @@ else if (type == GAIM_REQUEST_FIELD_CHOICE) { GntWidget *combo = field->ui_data;; - int id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); + int id; + id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); gaim_request_field_choice_set_value(field, id); } else if (type == GAIM_REQUEST_FIELD_LIST) Modified: trunk/console/gntrequest.h =================================================================== --- trunk/console/gntrequest.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntrequest.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,8 +1,12 @@ +#ifndef _GNT_REQUEST_H +#define _GNT_REQUEST_H + #include "request.h" -GaimRequestUiOps *gg_request_get_ui_ops(); +GaimRequestUiOps *gg_request_get_ui_ops(void); -void gg_request_init(); +void gg_request_init(void); -void gg_request_uninit(); +void gg_request_uninit(void); +#endif Modified: trunk/console/gntstatus.h =================================================================== --- trunk/console/gntstatus.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntstatus.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,7 +1,11 @@ +#ifndef _GNT_STATUS_H +#define _GNT_STATUS_H + #include <status.h> #include <savedstatuses.h> -void gg_savedstatus_show_all(); +void gg_savedstatus_show_all(void); void gg_savedstatus_edit(GaimSavedStatus *saved); +#endif Modified: trunk/console/gntui.h =================================================================== --- trunk/console/gntui.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/gntui.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -1,3 +1,8 @@ +#ifndef _GNT_UI_H +#define _GNT_UI_H + #include "gnt.h" -void init_gnt_ui(); +void init_gnt_ui(void); + +#endif Modified: trunk/console/libgnt/gntwidget.h =================================================================== --- trunk/console/libgnt/gntwidget.h 2006-08-19 02:57:06 UTC (rev 16869) +++ trunk/console/libgnt/gntwidget.h 2006-08-19 03:38:23 UTC (rev 16870) @@ -23,8 +23,6 @@ typedef struct _GnWidgetPriv GntWidgetPriv; typedef struct _GnWidgetClass GntWidgetClass; -#define N_(X) X - typedef enum _GnWidgetFlags { GNT_WIDGET_DESTROYING = 1 << 0, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 16:38:15
|
Revision: 16903 Author: sadrul Date: 2006-08-20 09:38:10 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16903&view=rev Log Message: ----------- Revert the last commit, because it was retarded. Make the appropriate changes. Make sure logging happens if enabled. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/libgnt/gnttextview.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-20 16:25:36 UTC (rev 16902) +++ trunk/console/gntconv.c 2006-08-20 16:38:10 UTC (rev 16903) @@ -236,6 +236,10 @@ g_return_if_fail(ggconv != NULL); + pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); + + gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); + if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); @@ -254,14 +258,11 @@ if (flags & GAIM_MESSAGE_NICK) fl |= GNT_TEXT_FLAG_UNDERLINE; - pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); - /* XXX: Remove this workaround when textview can parse messages. */ newline = gaim_strdup_withhtml(message); strip = gaim_markup_strip_html(newline); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), strip, fl); - gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); if (pos <= 1) gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); @@ -276,7 +277,7 @@ gg_write_chat(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) { - gg_write_common(conv, who, message, flags, mtime); + gaim_conversation_write(conv, who, message, flags, mtime); } static void @@ -301,7 +302,7 @@ who = gaim_buddy_get_contact_alias(buddy); } - gg_write_common(conv, who, message, flags, mtime); + gaim_conversation_write(conv, who, message, flags, mtime); } static void Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-08-20 16:25:36 UTC (rev 16902) +++ trunk/console/libgnt/gnttextview.c 2006-08-20 16:38:10 UTC (rev 16903) @@ -35,7 +35,7 @@ GList *iter; GntTextLine *line = lines->data; - wmove(widget->window, widget->priv.height - i, 0); + wmove(widget->window, widget->priv.height - 1 - i, 0); for (iter = line->segments; iter; iter = iter->next) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-20 19:37:43
|
Revision: 16916 Author: sadrul Date: 2006-08-20 12:37:33 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16916&view=rev Log Message: ----------- Mark the messages from gnthistory as delayed, and don't print the timestamps for delayed messages (I think it makes sense). Modified Paths: -------------- trunk/console/gntconv.c trunk/console/plugins/gnthistory.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-20 18:55:37 UTC (rev 16915) +++ trunk/console/gntconv.c 2006-08-20 19:37:33 UTC (rev 16916) @@ -240,7 +240,9 @@ gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); - if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) + /* Unnecessary to print the timestamp for delayed message */ + if (!(flags & GAIM_MESSAGE_DELAYED) && + gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps")) gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) Modified: trunk/console/plugins/gnthistory.c =================================================================== --- trunk/console/plugins/gnthistory.c 2006-08-20 18:55:37 UTC (rev 16915) +++ trunk/console/plugins/gnthistory.c 2006-08-20 19:37:33 UTC (rev 16916) @@ -50,6 +50,7 @@ guint flags; char *history; char *header; + GaimMessageFlags mflag; convtype = gaim_conversation_get_type(c); if (convtype == GAIM_CONV_TYPE_IM) @@ -112,18 +113,19 @@ if (logs == NULL) return; + mflag = GAIM_MESSAGE_NO_LOG | GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_DELAYED; history = gaim_log_read((GaimLog*)logs->data, &flags); header = g_strdup_printf(_("<b>Conversation with %s on %s:</b><br>"), alias, gaim_date_format_full(localtime(&((GaimLog *)logs->data)->time))); - gaim_conversation_write(c, "", header, GAIM_MESSAGE_NO_LOG, time(NULL)); + gaim_conversation_write(c, "", header, mflag, time(NULL)); g_free(header); g_strchomp(history); - gaim_conversation_write(c, "", history, GAIM_MESSAGE_NO_LOG, time(NULL)); + gaim_conversation_write(c, "", history, mflag, time(NULL)); g_free(history); - gaim_conversation_write(c, "", "\n---------------\n", GAIM_MESSAGE_NO_LOG, time(NULL)); + gaim_conversation_write(c, "", "<hr>", mflag, time(NULL)); g_list_foreach(logs, (GFunc)gaim_log_free, NULL); g_list_free(logs); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 03:40:19
|
Revision: 16938 Author: sadrul Date: 2006-08-20 20:40:12 -0700 (Sun, 20 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16938&view=rev Log Message: ----------- Mostly minor cleanups Modified Paths: -------------- trunk/console/gntconv.c trunk/console/gntgaim.c trunk/console/libgnt/gntcolors.c trunk/console/libgnt/gntentry.c trunk/console/libgnt/gntmain.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/gntconv.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -360,7 +360,7 @@ static void gg_chat_rename_user(GaimConversation *conv, const char *old, const char *new_n, const char *new_a) { - /* XXX: Update the name for string completion */ + /* Update the name for string completion */ GGConv *ggc = conv->ui_data; GntEntry *entry = GNT_ENTRY(ggc->entry); gnt_entry_remove_suggest(entry, old); @@ -371,7 +371,7 @@ static void gg_chat_remove_user(GaimConversation *conv, GList *list) { - /* XXX: Remove the name from string completion */ + /* Remove the name from string completion */ GGConv *ggc = conv->ui_data; GntEntry *entry = GNT_ENTRY(ggc->entry); for (; list; list = list->next) Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/gntgaim.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -249,11 +249,7 @@ gaim_plugins_add_search_path(path); g_free(path); -#ifdef LIBDIR gaim_plugins_add_search_path(LIBDIR); -#else - gaim_plugins_add_search_path("/usr/local/lib/gaim"); /* XXX: Remove this after the restructure */ -#endif if (!gaim_core_init(GAIM_GNT_UI)) { Modified: trunk/console/libgnt/gntcolors.c =================================================================== --- trunk/console/libgnt/gntcolors.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/libgnt/gntcolors.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -40,7 +40,7 @@ { backup_colors(); - /* XXX: Do some init_color()s */ + /* Do some init_color()s */ init_color(GNT_COLOR_BLACK, 0, 0, 0); init_color(GNT_COLOR_RED, 1000, 0, 0); init_color(GNT_COLOR_GREEN, 0, 1000, 0); @@ -115,8 +115,9 @@ if (error) { - /* XXX: some error happened. */ + g_printerr("GntColors: %s\n", error->message); g_error_free(error); + error = NULL; } else { @@ -156,7 +157,7 @@ if (error) { - /* XXX: some error happened. */ + g_printerr("GntColors: %s\n", error->message); g_error_free(error); return; } Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/libgnt/gntentry.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -304,7 +304,6 @@ return TRUE; } } - /* XXX: handle other keys, like home/end, and ctrl+ goodness */ else if (text[1] == 0) { destroy_suggest(entry); Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-21 03:19:16 UTC (rev 16937) +++ trunk/console/libgnt/gntmain.c 2006-08-21 03:40:12 UTC (rev 16938) @@ -1,4 +1,4 @@ -#include <panel.h> +#include <ncursesw/panel.h> #include "gnt.h" #include "gntbox.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-21 22:08:26
|
Revision: 16959 Author: sadrul Date: 2006-08-21 15:08:19 -0700 (Mon, 21 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16959&view=rev Log Message: ----------- Fix a bug where `gntgaim -v` does bad things to the terminal. Bug reported by Mark Schneider. Modified Paths: -------------- trunk/console/gntdebug.c trunk/console/gntgaim.c Modified: trunk/console/gntdebug.c =================================================================== --- trunk/console/gntdebug.c 2006-08-21 21:35:38 UTC (rev 16958) +++ trunk/console/gntdebug.c 2006-08-21 22:08:19 UTC (rev 16959) @@ -106,11 +106,18 @@ gnt_widget_show(debug.window); } +static gboolean +start_with_debugwin(gpointer null) +{ + gg_debug_window_show(); + return FALSE; +} + void gg_debug_init() { g_set_print_handler(print_stderr); /* Redirect the debug messages to stderr */ if (gaim_debug_is_enabled()) - gg_debug_window_show(); + g_timeout_add(0, start_with_debugwin, NULL); } void gg_debug_uninit() Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-21 21:35:38 UTC (rev 16958) +++ trunk/console/gntgaim.c 2006-08-21 22:08:19 UTC (rev 16959) @@ -153,7 +153,6 @@ " -v, --version display the current version and exit\n"), VERSION, name); } - gnt_quit(); gaim_print_utf8_to_console(stdout, text); g_free(text); } @@ -305,8 +304,6 @@ /* XXX: Don't puke */ freopen(".error", "w", stderr); - gnt_init(); - /* Initialize the libgaim stuff */ if (!init_libgaim(argc, argv)) return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-27 06:14:48
|
Revision: 17054 Author: sadrul Date: 2006-08-26 23:14:12 -0700 (Sat, 26 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17054&view=rev Log Message: ----------- Allow adding chats in the buddylist. And fix a few bugs along the way. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntconv.c trunk/console/gntgaim.c trunk/console/gntrequest.c trunk/console/libgnt/gntentry.c trunk/console/libgnt/gnttree.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntblist.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -210,6 +210,72 @@ } static void +add_chat_cb(void *data, GaimRequestFields *allfields) +{ + GaimAccount *account; + const char *alias, *name, *group; + GaimChat *chat; + GaimGroup *grp; + GHashTable *hash = NULL; + GaimConnection *gc; + + account = gaim_request_fields_get_account(allfields, "account"); + name = gaim_request_fields_get_string(allfields, "name"); + alias = gaim_request_fields_get_string(allfields, "alias"); + group = gaim_request_fields_get_string(allfields, "group"); + + if (!gaim_account_is_connected(account) || !name || !*name) + return; + + if (!group || !*group) + group = _("Chats"); + + gc = gaim_account_get_connection(account); + + if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL) + hash = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, name); + + chat = gaim_chat_new(account, name, hash); + + if (chat != NULL) { + if ((grp = gaim_find_group(group)) == NULL) { + grp = gaim_group_new(group); + gaim_blist_add_group(grp, NULL); + } + gaim_blist_add_chat(chat, grp, NULL); + } +} + +static void +gg_request_add_chat(GaimAccount *account, GaimGroup *grp, const char *alias, const char *name) +{ + GaimRequestFields *fields = gaim_request_fields_new(); + GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); + GaimRequestField *field; + + gaim_request_fields_add_group(fields, group); + + field = gaim_request_field_account_new("account", _("Account"), NULL); + gaim_request_field_account_set_show_all(field, FALSE); + if (account) + gaim_request_field_account_set_value(field, account); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("name", _("Name"), name, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("alias", _("Alias"), alias, FALSE); + gaim_request_field_group_add_field(group, field); + + field = gaim_request_field_string_new("group", _("Group"), grp->name, FALSE); + gaim_request_field_group_add_field(group, field); + + gaim_request_fields(NULL, _("Add Chat"), NULL, + _("You can edit more information from the context menu later."), + fields, _("Add"), G_CALLBACK(add_chat_cb), _("Cancel"), NULL, NULL); +} + +static void add_group_cb(gpointer null, const char *group) { GaimGroup *grp; @@ -252,7 +318,7 @@ NULL, NULL, .request_add_buddy = gg_request_add_buddy, - NULL, + .request_add_chat = gg_request_add_chat, .request_add_group = gg_request_add_group }; @@ -466,15 +532,77 @@ } static void +chat_components_edit_ok(GaimChat *chat, GaimRequestFields *allfields) +{ + GList *groups, *fields; + + for (groups = gaim_request_fields_get_groups(allfields); groups; groups = groups->next) { + fields = gaim_request_field_group_get_fields(groups->data); + for (; fields; fields = fields->next) { + GaimRequestField *field = fields->data; + const char *id; + char *val; + + id = gaim_request_field_get_id(field); + if (gaim_request_field_get_type(field) == GAIM_REQUEST_FIELD_INTEGER) + val = g_strdup_printf("%d", gaim_request_field_int_get_value(field)); + else + val = g_strdup(gaim_request_field_string_get_value(field)); + + g_hash_table_replace(chat->components, g_strdup(id), val); /* val should not be free'd */ + } + } +} + +static void +chat_components_edit(GaimChat *chat, GaimBlistNode *null) +{ + GaimRequestFields *fields = gaim_request_fields_new(); + GaimRequestFieldGroup *group = gaim_request_field_group_new(NULL); + GaimRequestField *field; + GList *parts, *iter; + struct proto_chat_entry *pce; + + gaim_request_fields_add_group(fields, group); + + parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc); + + for (iter = parts; iter; iter = iter->next) { + pce = iter->data; + if (pce->is_int) { + int val; + const char *str = g_hash_table_lookup(chat->components, pce->identifier); + if (!str || sscanf(str, "%d", &val) != 1) + val = pce->min; + field = gaim_request_field_int_new(pce->identifier, pce->label, val); + } else { + field = gaim_request_field_string_new(pce->identifier, pce->label, + g_hash_table_lookup(chat->components, pce->identifier), FALSE); + } + + gaim_request_field_group_add_field(group, field); + g_free(pce); + } + + g_list_free(parts); + + gaim_request_fields(NULL, _("Edit Chat"), NULL, _("Please Update the necessary fields."), + fields, _("Edit"), G_CALLBACK(chat_components_edit_ok), _("Cancel"), NULL, chat); +} + +static void create_chat_menu(GntTree *tree, GaimChat *chat) { GaimMenuAction *action = gaim_menu_action_new(_("Auto-join"), NULL, chat, NULL); gnt_tree_add_choice(tree, action, gnt_tree_create_row(tree, action->label), NULL, NULL); gnt_tree_set_choice(tree, action, gaim_blist_node_get_bool((GaimBlistNode*)chat, "gnt-autojoin")); - + g_signal_connect_swapped(G_OBJECT(tree), "destroy", G_CALLBACK(gaim_menu_action_free), action); + + add_custom_action(tree, _("Edit Settings"), (GaimCallback)chat_components_edit, chat); + g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(context_menu_toggle), NULL); } @@ -491,10 +619,18 @@ } static void +gg_add_chat(GaimGroup *grp, GaimBlistNode *node) +{ + gaim_blist_request_add_chat(NULL, grp, NULL, NULL); +} + +static void create_group_menu(GntTree *tree, GaimGroup *group) { add_custom_action(tree, _("Add Buddy"), GAIM_CALLBACK(gg_add_buddy), group); + add_custom_action(tree, _("Add Chat"), + GAIM_CALLBACK(gg_add_chat), group); add_custom_action(tree, _("Add Group"), GAIM_CALLBACK(gg_add_group), group); } @@ -1005,7 +1141,8 @@ node = gaim_blist_node_next(node, TRUE); } - remove_typing_cb(NULL); + if (ggblist->typing) + g_source_remove(ggblist->typing); remove_peripherals(ggblist); g_free(ggblist); ggblist = NULL; @@ -1359,9 +1496,12 @@ ggblist = NULL; } -void gg_blist_get_position(int *x, int *y) +gboolean gg_blist_get_position(int *x, int *y) { + if (!ggblist || !ggblist->window) + return FALSE; gnt_widget_get_position(ggblist->window, x, y); + return TRUE; } void gg_blist_set_position(int x, int y) @@ -1369,9 +1509,12 @@ gnt_widget_set_position(ggblist->window, x, y); } -void gg_blist_get_size(int *width, int *height) +gboolean gg_blist_get_size(int *width, int *height) { + if (!ggblist || !ggblist->window) + return FALSE; gnt_widget_get_size(ggblist->window, width, height); + return TRUE; } void gg_blist_set_size(int width, int height) Modified: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntblist.h 2006-08-27 06:14:12 UTC (rev 17054) @@ -11,11 +11,11 @@ void gg_blist_show(void); -void gg_blist_get_position(int *x, int *y); +gboolean gg_blist_get_position(int *x, int *y); void gg_blist_set_position(int x, int y); -void gg_blist_get_size(int *width, int *height); +gboolean gg_blist_get_size(int *width, int *height); void gg_blist_set_size(int width, int height); Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntconv.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -191,7 +191,7 @@ gnt_box_set_title(GNT_BOX(ggc->window), title); gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); gnt_box_set_pad(GNT_BOX(ggc->window), 0); - gnt_widget_set_name(ggc->window, title); + gnt_widget_set_name(ggc->window, "conversation-window"); ggc->tv = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(ggc->window), ggc->tv); Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntgaim.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -224,7 +224,7 @@ } /* show version message */ if (opt_version) { - printf("Gaim %s\n", VERSION); + printf("gntgaim %s\n", VERSION); return 0; } Modified: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/gntrequest.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -361,8 +361,12 @@ } else if (type == GAIM_REQUEST_FIELD_INTEGER) { - GntWidget *entry = gnt_entry_new( - gaim_request_field_string_get_default_value(field)); + char str[256]; + int val = gaim_request_field_int_get_default_value(field); + GntWidget *entry; + + snprintf(str, sizeof(str), "%d", val); + entry = gnt_entry_new(str); gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); gnt_box_add_widget(GNT_BOX(hbox), entry); field->ui_data = entry; Modified: trunk/console/libgnt/gntentry.c =================================================================== --- trunk/console/libgnt/gntentry.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/libgnt/gntentry.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -349,7 +349,7 @@ { const char *str, *next; - for (str = text; *str;) + for (str = text; *str; str = next) { int len; next = g_utf8_find_next_char(str, NULL); Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-27 02:44:52 UTC (rev 17053) +++ trunk/console/libgnt/gnttree.c 2006-08-27 06:14:12 UTC (rev 17054) @@ -633,10 +633,14 @@ tree->current = row; redraw_tree(tree); tree_selection_changed(tree, old, tree->current); - } else if (row == tree->current && row->choice) { - row->isselected = !row->isselected; - g_signal_emit(tree, signals[SIG_TOGGLED], 0, row->key); - redraw_tree(tree); + } else if (row && row == tree->current) { + if (row->choice) { + row->isselected = !row->isselected; + g_signal_emit(tree, signals[SIG_TOGGLED], 0, row->key); + redraw_tree(tree); + } else { + gnt_widget_activate(widget); + } } } else { return FALSE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-30 05:07:57
|
Revision: 17085 Author: sadrul Date: 2006-08-29 22:07:43 -0700 (Tue, 29 Aug 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=17085&view=rev Log Message: ----------- Parts of Richard Nelson (wabz)'s patch: Emit the selection-changed signal when you wheel-scroll. Show the idle-time only when it has an appropriate idle-time. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gnttree.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-30 04:19:14 UTC (rev 17084) +++ trunk/console/gntblist.c 2006-08-30 05:07:43 UTC (rev 17085) @@ -977,9 +977,11 @@ if (gaim_presence_is_idle(pre)) { time_t idle = gaim_presence_get_idle_time(pre); - char *st = gaim_str_seconds_to_string(time(NULL) - idle); - g_string_append_printf(str, _("\nIdle: %s"), st); - g_free(st); + if (idle > 0) { + char *st = gaim_str_seconds_to_string(time(NULL) - idle); + g_string_append_printf(str, _("\nIdle: %s"), st); + g_free(st); + } } } Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-30 04:19:14 UTC (rev 17084) +++ trunk/console/libgnt/gnttree.c 2006-08-30 05:07:43 UTC (rev 17085) @@ -614,6 +614,8 @@ static gboolean gnt_tree_clicked(GntWidget *widget, GntMouseEvent event, int x, int y) { + GntTree *tree = GNT_TREE(widget); + GntTreeRow *old = tree->current; if (event == GNT_MOUSE_SCROLL_UP) { action_up(GNT_TREE(widget)); } else if (event == GNT_MOUSE_SCROLL_DOWN) { @@ -645,6 +647,9 @@ } else { return FALSE; } + if (old != tree->current) { + tree_selection_changed(tree, old, tree->current); + } return TRUE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-31 00:58:58
|
Revision: 17090 http://svn.sourceforge.net/gaim/?rev=17090&view=rev Author: sadrul Date: 2006-08-30 17:58:50 -0700 (Wed, 30 Aug 2006) Log Message: ----------- Contactize the buddylist. But there's no way to move a buddy in some contact yet. Drag-dropping might be possible, but I'll probably go with a menuitem in the context-menu. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-30 23:29:42 UTC (rev 17089) +++ trunk/console/gntblist.c 2006-08-31 00:58:50 UTC (rev 17090) @@ -61,6 +61,7 @@ GGBlist *ggblist; static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist); +static void add_contact(GaimContact *contact, GGBlist *ggblist); static void add_group(GaimGroup *group, GGBlist *ggblist); static void add_chat(GaimChat *chat, GGBlist *ggblist); static void add_node(GaimBlistNode *node, GGBlist *ggblist); @@ -79,6 +80,8 @@ { if (GAIM_BLIST_NODE_IS_BUDDY(node)) add_buddy((GaimBuddy*)node, ggblist); + else if (GAIM_BLIST_NODE_IS_CONTACT(node)) + add_contact((GaimContact*)node, ggblist); else if (GAIM_BLIST_NODE_IS_GROUP(node)) add_group((GaimGroup*)node, ggblist); else if (GAIM_BLIST_NODE_IS_CHAT(node)) @@ -107,9 +110,9 @@ if (GAIM_BLIST_NODE_IS_BUDDY(node)) { - GaimGroup *group = gaim_buddy_get_group((GaimBuddy*)node); - if (gaim_blist_get_group_online_count(group) == 0) - node_remove(list, (GaimBlistNode*)group); + GaimContact *contact = (GaimContact*)node->parent; + if (contact->online < 1) + node_remove(list, (GaimBlistNode*)contact); } draw_tooltip(ggblist); } @@ -348,6 +351,12 @@ char status[8] = " "; const char *name = NULL; + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node); /* XXX: this can return NULL?! */ + + if (node == NULL) + return NULL; + if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy *)node; @@ -413,20 +422,46 @@ } static void +add_contact(GaimContact *contact, GGBlist *ggblist) +{ + GaimGroup *group; + GaimBlistNode *node = (GaimBlistNode*)contact; + GaimBuddy *buddy; + + if (node->ui_data) + return; + + group = (GaimGroup*)node->parent; + add_node((GaimBlistNode*)group, ggblist); + + node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact, + gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), + group, NULL); + + gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); + + buddy = gaim_contact_get_priority_buddy(contact); + if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) + gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, GNT_TEXT_FLAG_DIM); + else + gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), contact, 0); +} + +static void add_buddy(GaimBuddy *buddy, GGBlist *ggblist) { - GaimGroup *group; + GaimContact *contact; GaimBlistNode *node = (GaimBlistNode *)buddy; if (node->ui_data) return; - group = gaim_buddy_get_group(buddy); - add_node((GaimBlistNode*)group, ggblist); + contact = (GaimContact*)node->parent; + add_node((GaimBlistNode*)contact, ggblist); gnt_tree_remove(GNT_TREE(ggblist->tree), buddy); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), - group, NULL); + contact, NULL); if (gaim_presence_is_idle(gaim_buddy_get_presence(buddy))) gnt_tree_set_row_flags(GNT_TREE(ggblist->tree), buddy, GNT_TEXT_FLAG_DIM); else @@ -460,6 +495,9 @@ if (!node) return; + + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node); if (GAIM_BLIST_NODE_IS_BUDDY(node)) { @@ -713,7 +751,9 @@ if (name && !*name) name = NULL; - if (GAIM_BLIST_NODE_IS_BUDDY(node)) + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + gaim_blist_alias_contact((GaimContact*)node, name); + else if (GAIM_BLIST_NODE_IS_BUDDY(node)) gaim_blist_alias_buddy((GaimBuddy*)node, name); else if (GAIM_BLIST_NODE_IS_CHAT(node)) gaim_blist_alias_chat((GaimChat*)node, name); @@ -729,7 +769,9 @@ const char *name = NULL; char *prompt; - if (GAIM_BLIST_NODE_IS_BUDDY(node)) + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + name = gaim_contact_get_alias((GaimContact*)node); + else if (GAIM_BLIST_NODE_IS_BUDDY(node)) name = gaim_buddy_get_contact_alias((GaimBuddy*)node); else if (GAIM_BLIST_NODE_IS_CHAT(node)) name = gaim_chat_get_name((GaimChat*)node); @@ -788,19 +830,16 @@ static void gg_blist_remove_node(GaimBlistNode *node) { - if (GAIM_BLIST_NODE_IS_BUDDY(node)) - { + if (GAIM_BLIST_NODE_IS_CONTACT(node)) { + gaim_blist_remove_contact((GaimContact*)node); + } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy*)node; GaimGroup *group = gaim_buddy_get_group(buddy); gaim_account_remove_buddy(gaim_buddy_get_account(buddy), buddy, group); gaim_blist_remove_buddy(buddy); - } - else if (GAIM_BLIST_NODE_IS_CHAT(node)) - { + } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { gaim_blist_remove_chat((GaimChat*)node); - } - else if (GAIM_BLIST_NODE_IS_GROUP(node)) - { + } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { remove_group((GaimGroup*)node); } } @@ -811,7 +850,10 @@ char *primary; const char *name, *sec = NULL; - if (GAIM_BLIST_NODE_IS_BUDDY(node)) + /* XXX: could be a contact */ + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + name = gaim_contact_get_alias((GaimContact*)node); + else if (GAIM_BLIST_NODE_IS_BUDDY(node)) name = gaim_buddy_get_name((GaimBuddy*)node); else if (GAIM_BLIST_NODE_IS_CHAT(node)) name = gaim_chat_get_name((GaimChat*)node); @@ -863,6 +905,10 @@ gnt_widget_set_name(context, "context menu"); g_signal_connect(G_OBJECT(context), "activate", G_CALLBACK(context_menu_callback), ggblist); + /* XXX: For now, for a contact, the context menu for the priority buddy will popup */ + if (GAIM_BLIST_NODE_IS_CONTACT(node)) + node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node); + if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy *)node; @@ -912,14 +958,52 @@ } static void +tooltip_for_buddy(GaimBuddy *buddy, GString *str) +{ + GaimPlugin *prpl; + GaimPluginProtocolInfo *prpl_info; + GaimAccount *account; + + account = gaim_buddy_get_account(buddy); + + g_string_append_printf(str, _("Account: %s (%s)"), + gaim_account_get_username(account), + gaim_account_get_protocol_name(account)); + + prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); + prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); + if (prpl_info && prpl_info->tooltip_text) { + GString *tip = g_string_new(""); + char *strip, *br; + prpl_info->tooltip_text(buddy, tip, TRUE); + + br = gaim_strreplace(tip->str, "\n", "<br>"); + strip = gaim_markup_strip_html(br); + g_string_append(str, strip); + g_string_free(tip, TRUE); + g_free(strip); + g_free(br); + } + + if (gaim_prefs_get_bool("/gaim/gnt/blist/idletime")) { + GaimPresence *pre = gaim_buddy_get_presence(buddy); + if (gaim_presence_is_idle(pre)) { + time_t idle = gaim_presence_get_idle_time(pre); + if (idle > 0) { + char *st = gaim_str_seconds_to_string(time(NULL) - idle); + g_string_append_printf(str, _("\nIdle: %s"), st); + g_free(st); + } + } + } +} + +static void draw_tooltip(GGBlist *ggblist) { GaimBlistNode *node; int x, y, top, width; GString *str; - GaimPlugin *prpl; - GaimPluginProtocolInfo *prpl_info; - GaimAccount *account; GntTree *tree; GntWidget *widget, *box; char *title = NULL; @@ -946,49 +1030,21 @@ str = g_string_new(""); - if (GAIM_BLIST_NODE_IS_BUDDY(node)) - { + if (GAIM_BLIST_NODE_IS_CONTACT(node)) { + GaimBuddy *pr = gaim_contact_get_priority_buddy((GaimContact*)node); + title = g_strdup(gaim_contact_get_alias((GaimContact*)node)); + tooltip_for_buddy(pr, str); + for (node = node->child; node; node = node->next) { + if (node == (GaimBlistNode*)pr || !GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node)) + continue; + str = g_string_append(str, "\n----------\n"); + tooltip_for_buddy((GaimBuddy*)node, str); + } + } else if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy *)node; - account = gaim_buddy_get_account(buddy); - - g_string_append_printf(str, _("Account: %s (%s)"), - gaim_account_get_username(account), - gaim_account_get_protocol_name(account)); - - prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); - prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl); - if (prpl_info && prpl_info->tooltip_text) - { - GString *tip = g_string_new(""); - char *strip, *br; - prpl_info->tooltip_text(buddy, tip, TRUE); - - br = gaim_strreplace(tip->str, "\n", "<br>"); - strip = gaim_markup_strip_html(br); - g_string_append(str, strip); - g_string_free(tip, TRUE); - g_free(strip); - g_free(br); - } - - if (gaim_prefs_get_bool("/gaim/gnt/blist/idletime")) - { - GaimPresence *pre = gaim_buddy_get_presence(buddy); - if (gaim_presence_is_idle(pre)) - { - time_t idle = gaim_presence_get_idle_time(pre); - if (idle > 0) { - char *st = gaim_str_seconds_to_string(time(NULL) - idle); - g_string_append_printf(str, _("\nIdle: %s"), st); - g_free(st); - } - } - } - + tooltip_for_buddy(buddy, str); title = g_strdup(gaim_buddy_get_name(buddy)); - } - else if (GAIM_BLIST_NODE_IS_GROUP(node)) - { + } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { GaimGroup *group = (GaimGroup *)node; g_string_append_printf(str, _("Online: %d\nTotal: %d"), @@ -996,9 +1052,7 @@ gaim_blist_get_group_size(group, FALSE)); title = g_strdup(group->name); - } - else if (GAIM_BLIST_NODE_IS_CHAT(node)) - { + } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { GaimChat *chat = (GaimChat *)node; GaimAccount *account = chat->account; @@ -1007,9 +1061,7 @@ gaim_account_get_protocol_name(account)); title = g_strdup(gaim_chat_get_name(chat)); - } - else - { + } else { g_string_free(str, TRUE); return; } Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-08-30 23:29:42 UTC (rev 17089) +++ trunk/console/libgnt/gnttree.c 2006-08-31 00:58:50 UTC (rev 17090) @@ -111,7 +111,7 @@ while(row->next) row = row->next; - if (row->child) + if (!row->collapsed && row->child) row = get_last_child(row->child); return row; } @@ -1215,3 +1215,12 @@ tree->compare = func; } +void gnt_tree_set_expanded(GntTree *tree, void *key, gboolean expanded) +{ + GntTreeRow *row = g_hash_table_lookup(tree->hash, key); + if (row) { + row->collapsed = !expanded; + if (GNT_WIDGET(tree)->window) + gnt_widget_draw(GNT_WIDGET(tree)); + } +} Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-08-30 23:29:42 UTC (rev 17089) +++ trunk/console/libgnt/gnttree.h 2006-08-31 00:58:50 UTC (rev 17090) @@ -118,6 +118,8 @@ void gnt_tree_set_compare_func(GntTree *tree, GCompareFunc func); +void gnt_tree_set_expanded(GntTree *tree, void *key, gboolean expanded); + G_END_DECLS #endif /* GNT_TREE_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-08-31 04:39:41
|
Revision: 17094 http://svn.sourceforge.net/gaim/?rev=17094&view=rev Author: sadrul Date: 2006-08-30 21:39:21 -0700 (Wed, 30 Aug 2006) Log Message: ----------- Contactize the conversations. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/gntconv.c trunk/console/gntconv.h trunk/console/libgnt/gnt.h trunk/console/libgnt/gntbox.c trunk/console/libgnt/gntmain.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-08-31 03:13:54 UTC (rev 17093) +++ trunk/console/gntblist.c 2006-08-31 04:39:21 UTC (rev 17094) @@ -17,6 +17,7 @@ #include "gnttree.h" #include "gntblist.h" +#include "gntconv.h" #include "gntstatus.h" #include <string.h> @@ -496,9 +497,10 @@ if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy *)node; - gaim_conversation_new(GAIM_CONV_TYPE_IM, - gaim_buddy_get_account(buddy), - gaim_buddy_get_name(buddy)); + GaimConversation *conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, + gaim_buddy_get_account(buddy), + gaim_buddy_get_name(buddy)); + gg_conversation_set_active(conv); } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-08-31 03:13:54 UTC (rev 17093) +++ trunk/console/gntconv.c 2006-08-31 04:39:21 UTC (rev 17094) @@ -22,15 +22,15 @@ #include "config.h" -GHashTable *ggconvs; - typedef struct _GGConv GGConv; typedef struct _GGConvChat GGConvChat; typedef struct _GGConvIm GGConvIm; struct _GGConv { - GaimConversation *conv; + GList *list; + GaimConversation *active_conv; + /*GaimConversation *conv;*/ GntWidget *window; /* the container */ GntWidget *entry; /* entry */ @@ -61,7 +61,7 @@ const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); if (*text == '/') { - GaimConversation *conv = ggconv->conv; + GaimConversation *conv = ggconv->active_conv; GaimCmdStatus status; const char *cmdline = text + 1; char *error = NULL, *escape; @@ -112,13 +112,13 @@ else { char *escape = g_markup_escape_text(text, -1); - switch (gaim_conversation_get_type(ggconv->conv)) + switch (gaim_conversation_get_type(ggconv->active_conv)) { case GAIM_CONV_TYPE_IM: - gaim_conv_im_send_with_flags(GAIM_CONV_IM(ggconv->conv), escape, GAIM_MESSAGE_SEND); + gaim_conv_im_send_with_flags(GAIM_CONV_IM(ggconv->active_conv), escape, GAIM_MESSAGE_SEND); break; case GAIM_CONV_TYPE_CHAT: - gaim_conv_chat_send(GAIM_CONV_CHAT(ggconv->conv), escape); + gaim_conv_chat_send(GAIM_CONV_CHAT(ggconv->active_conv), escape); break; default: g_free(escape); @@ -151,8 +151,13 @@ static void closing_window(GntWidget *window, GGConv *ggconv) { + GList *list = ggconv->list; ggconv->window = NULL; - gaim_conversation_destroy(ggconv->conv); + while (list) { + GaimConversation *conv = list->data; + list = list->next; + gaim_conversation_destroy(conv); + } } static void @@ -169,24 +174,55 @@ gaim_prefs_set_int(PREF_ROOT "/position/y", y); } +static GaimConversation * +find_conv_with_contact(GaimConversation *conv) +{ + GaimBlistNode *node; + GaimBuddy *buddy = gaim_find_buddy(conv->account, conv->name); + GaimConversation *ret = NULL; + + if (!buddy) + return NULL; + + for (node = ((GaimBlistNode*)buddy)->parent->child; node; node = node->next) { + if (node == (GaimBlistNode*)buddy) + continue; + if ((ret = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, + ((GaimBuddy*)node)->name, ((GaimBuddy*)node)->account)) != NULL) + break; + } + return ret; +} + static void gg_create_conversation(GaimConversation *conv) { - GGConv *ggc = g_hash_table_lookup(ggconvs, conv); + GGConv *ggc = conv->ui_data; char *title; GaimConversationType type; + GaimConversation *cc; if (ggc) return; - ggc = g_new0(GGConv, 1); - g_hash_table_insert(ggconvs, conv, ggc); + cc = find_conv_with_contact(conv); + if (cc && cc->ui_data) + ggc = cc->ui_data; + else + ggc = g_new0(GGConv, 1); - ggc->conv = conv; + ggc->list = g_list_prepend(ggc->list, conv); + ggc->active_conv = conv; conv->ui_data = ggc; + if (cc && cc->ui_data) { + gg_conversation_set_active(conv); + return; + } + type = gaim_conversation_get_type(conv); title = g_strdup_printf(_("%s"), gaim_conversation_get_title(conv)); + ggc->window = gnt_box_new(FALSE, TRUE); gnt_box_set_title(GNT_BOX(ggc->window), title); gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE); @@ -222,20 +258,36 @@ static void gg_destroy_conversation(GaimConversation *conv) { - g_hash_table_remove(ggconvs, conv); + /* do stuff here */ + GGConv *ggc = conv->ui_data; + ggc->list = g_list_remove(ggc->list, conv); + if (ggc->list && conv == ggc->active_conv) + ggc->active_conv = ggc->list->data; + + if (ggc->list == NULL) { + gnt_widget_destroy(ggc->window); + g_free(ggc); + } } static void gg_write_common(GaimConversation *conv, const char *who, const char *message, GaimMessageFlags flags, time_t mtime) { - GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); /* XXX: ggconv = conv->ui_data; should do */ + GGConv *ggconv = conv->ui_data; char *strip, *newline; GntTextFormatFlags fl = 0; int pos; g_return_if_fail(ggconv != NULL); + if (ggconv->active_conv != conv) { + if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV)) + gg_conversation_set_active(conv); + else + return; + } + pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); @@ -408,14 +460,6 @@ .custom_smiley_close = NULL }; -static void -destroy_ggconv(gpointer data) -{ - GGConv *ggconv = data; - gnt_widget_destroy(ggconv->window); - g_free(ggconv); -} - GaimConversationUiOps *gg_conv_get_ui_ops() { return &conv_ui_ops; @@ -536,8 +580,6 @@ void gg_conversation_init() { - ggconvs = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, destroy_ggconv); - gaim_prefs_add_none(PREF_ROOT); gaim_prefs_add_none(PREF_ROOT "/size"); gaim_prefs_add_int(PREF_ROOT "/size/width", 70); @@ -586,7 +628,16 @@ void gg_conversation_uninit() { - g_hash_table_destroy(ggconvs); - ggconvs = NULL; } +void gg_conversation_set_active(GaimConversation *conv) +{ + GGConv *ggconv = conv->ui_data; + + g_return_if_fail(ggconv); + g_return_if_fail(g_list_find(ggconv->list, conv)); + + ggconv->active_conv = conv; + gnt_screen_rename_widget(ggconv->window, gaim_conversation_get_title(conv)); +} + Modified: trunk/console/gntconv.h =================================================================== --- trunk/console/gntconv.h 2006-08-31 03:13:54 UTC (rev 17093) +++ trunk/console/gntconv.h 2006-08-31 04:39:21 UTC (rev 17094) @@ -9,4 +9,7 @@ void gg_conversation_uninit(void); +/* Set a conversation as active in a contactized conversation */ +void gg_conversation_set_active(GaimConversation *conv); + #endif Modified: trunk/console/libgnt/gnt.h =================================================================== --- trunk/console/libgnt/gnt.h 2006-08-31 03:13:54 UTC (rev 17093) +++ trunk/console/libgnt/gnt.h 2006-08-31 04:39:21 UTC (rev 17094) @@ -21,6 +21,8 @@ void gnt_screen_move_widget(GntWidget *widget, int x, int y); +void gnt_screen_rename_widget(GntWidget *widget, const char *text); + gboolean gnt_widget_has_focus(GntWidget *widget); void gnt_widget_set_urgent(GntWidget *widget); Modified: trunk/console/libgnt/gntbox.c =================================================================== --- trunk/console/libgnt/gntbox.c 2006-08-31 03:13:54 UTC (rev 17093) +++ trunk/console/libgnt/gntbox.c 2006-08-31 04:39:21 UTC (rev 17094) @@ -41,6 +41,9 @@ gchar *title = g_strdup(box->title); int pos = g_utf8_strlen(title, -1), right; + mvwhline(widget->window, 0, 1, ACS_HLINE | COLOR_PAIR(GNT_COLOR_NORMAL), + widget->priv.width - 2); + if (pos >= widget->priv.width - 4) { g_utf8_strncpy(title, box->title, widget->priv.width - 4); Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-08-31 03:13:54 UTC (rev 17093) +++ trunk/console/libgnt/gntmain.c 2006-08-31 04:39:21 UTC (rev 17094) @@ -1188,3 +1188,10 @@ update_screen(NULL); } +void gnt_screen_rename_widget(GntWidget *widget, const char *text) +{ + gnt_box_set_title(GNT_BOX(widget), text); + gnt_widget_draw(widget); + draw_taskbar(FALSE); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2006-08-31 08:58:50
|
Revision: 17097 http://svn.sourceforge.net/gaim/?rev=17097&view=rev Author: thekingant Date: 2006-08-31 01:58:36 -0700 (Thu, 31 Aug 2006) Log Message: ----------- Add two things to the svn:ignore property Property Changed: ---------------- trunk/console/ trunk/console/plugins/ Property changes on: trunk/console ___________________________________________________________________ Name: svn:ignore - Makefile.in gmon.out .libs .deps Makefile .error + Makefile.in gmon.out gntgaim .libs .deps Makefile .error Property changes on: trunk/console/plugins ___________________________________________________________________ Name: svn:ignore - Makefile.in .deps Makefile + Makefile.in .deps .libs Makefile This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-01 07:10:06
|
Revision: 17107 http://svn.sourceforge.net/gaim/?rev=17107&view=rev Author: sadrul Date: 2006-09-01 00:09:40 -0700 (Fri, 01 Sep 2006) Log Message: ----------- Add an option to 'Show offline buddies'. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/gntprefs.c trunk/console/libgnt/gnttextview.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-09-01 06:38:46 UTC (rev 17106) +++ trunk/console/gntblist.c 2006-09-01 07:09:40 UTC (rev 17107) @@ -109,11 +109,15 @@ gnt_tree_remove(GNT_TREE(ggblist->tree), node); node->ui_data = NULL; - if (GAIM_BLIST_NODE_IS_BUDDY(node)) - { + if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimContact *contact = (GaimContact*)node->parent; if (contact->online < 1) node_remove(list, (GaimBlistNode*)contact); + } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) { + GaimGroup *group = (GaimGroup*)node->parent; + if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && group->online < 1) || + group->currentsize < 1) + node_remove(list, node->parent); } draw_tooltip(ggblist); } @@ -136,7 +140,8 @@ if (GAIM_BLIST_NODE_IS_BUDDY(node)) { GaimBuddy *buddy = (GaimBuddy*)node; - if (gaim_presence_is_online(gaim_buddy_get_presence(buddy))) + if (gaim_account_is_connected(buddy->account) && + (GAIM_BUDDY_IS_ONLINE(buddy) || gaim_prefs_get_bool(PREF_ROOT "/showoffline"))) add_node((GaimBlistNode*)buddy, list->ui_data); else node_remove(gaim_get_blist(), node); @@ -343,7 +348,6 @@ GaimBlistNode *node = (GaimBlistNode *)group; if (node->ui_data) return; - gnt_tree_remove(GNT_TREE(ggblist->tree), group); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), group, gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), NULL, NULL); } @@ -416,7 +420,6 @@ group = gaim_chat_get_group(chat); add_node((GaimBlistNode*)group, ggblist); - gnt_tree_remove(GNT_TREE(ggblist->tree), chat); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), chat, gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), group, NULL); @@ -430,15 +433,20 @@ { GaimGroup *group; GaimBlistNode *node = (GaimBlistNode*)contact; + const char *name; if (node->ui_data) return; + name = get_display_name(node); + if (name == NULL) + return; + group = (GaimGroup*)node->parent; add_node((GaimBlistNode*)group, ggblist); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), contact, - gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), + gnt_tree_create_row(GNT_TREE(ggblist->tree), name), group, NULL); gnt_tree_set_expanded(GNT_TREE(ggblist->tree), contact, FALSE); @@ -455,7 +463,6 @@ contact = (GaimContact*)node->parent; add_node((GaimBlistNode*)contact, ggblist); - gnt_tree_remove(GNT_TREE(ggblist->tree), buddy); node->ui_data = gnt_tree_add_row_after(GNT_TREE(ggblist->tree), buddy, gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), contact, NULL); @@ -1195,8 +1202,7 @@ gaim_get_blist()->ui_data = NULL; node = gaim_blist_get_root(); - while (node) - { + while (node) { node->ui_data = NULL; node = gaim_blist_node_next(node, TRUE); } @@ -1284,6 +1290,20 @@ items, (GDestroyNotify)destroy_status_list); } +static void +redraw_blist(const char *name, GaimPrefType type, gconstpointer val, gpointer data) +{ + GaimBlistNode *node; + if (ggblist == NULL) + return; + + gnt_tree_remove_all(GNT_TREE(ggblist->tree)); + node = gaim_blist_get_root(); + for (; node; node = gaim_blist_node_next(node, TRUE)) + node->ui_data = NULL; + populate_buddylist(); +} + void gg_blist_init() { gaim_prefs_add_none(PREF_ROOT); @@ -1293,9 +1313,14 @@ gaim_prefs_add_none(PREF_ROOT "/position"); gaim_prefs_add_int(PREF_ROOT "/position/x", 0); gaim_prefs_add_int(PREF_ROOT "/position/y", 0); + gaim_prefs_add_bool(PREF_ROOT "/idletime", TRUE); + gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE); gg_blist_show(); + gaim_prefs_connect_callback(gg_blist_get_handle(), + PREF_ROOT "/showoffline", redraw_blist, NULL); + return; } Modified: trunk/console/gntprefs.c =================================================================== --- trunk/console/gntprefs.c 2006-09-01 06:38:46 UTC (rev 17106) +++ trunk/console/gntprefs.c 2006-09-01 07:09:40 UTC (rev 17107) @@ -14,9 +14,6 @@ gaim_prefs_add_none("/gaim/gnt/plugins"); gaim_prefs_add_string_list("/gaim/gnt/plugins/loaded", NULL); - gaim_prefs_add_none("/gaim/gnt/blist"); - gaim_prefs_add_bool("/gaim/gnt/blist/idletime", TRUE); - gaim_prefs_add_none("/gaim/gnt/conversations"); gaim_prefs_add_bool("/gaim/gnt/conversations/timestamps", TRUE); gaim_prefs_add_bool("/gaim/gnt/conversations/notify_typing", FALSE); /* XXX: Not functional yet */ @@ -99,6 +96,7 @@ static Prefs blist[] = { {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/idletime", N_("Show Idle Time"), NULL}, + {GAIM_PREF_BOOLEAN, "/gaim/gnt/blist/showoffline", N_("Show Offline Buddies"), NULL}, {GAIM_PREF_NONE, NULL, NULL, NULL} }; Modified: trunk/console/libgnt/gnttextview.c =================================================================== --- trunk/console/libgnt/gnttextview.c 2006-09-01 06:38:46 UTC (rev 17106) +++ trunk/console/libgnt/gnttextview.c 2006-09-01 07:09:40 UTC (rev 17107) @@ -100,7 +100,7 @@ { if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_MAPPED)) { - gnt_widget_set_size(widget, 64, 24); + gnt_widget_set_size(widget, 64, 20); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-01 12:07:04
|
Revision: 17113 http://svn.sourceforge.net/gaim/?rev=17113&view=rev Author: sadrul Date: 2006-09-01 05:06:51 -0700 (Fri, 01 Sep 2006) Log Message: ----------- Pressing Alt+a will bring up a list of available 'actions', which you can use show the buddylist/accounts/debug etc. windows. Pressing ctrl+o in the buddylist will toggle showing online/offline users. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/gntui.c trunk/console/libgnt/gnt.h trunk/console/libgnt/gntmain.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-09-01 11:03:18 UTC (rev 17112) +++ trunk/console/gntblist.c 2006-09-01 12:06:51 UTC (rev 17113) @@ -1130,6 +1130,13 @@ ret = TRUE; } } + else if (strcmp(text, GNT_KEY_CTRL_O) == 0) + { + gaim_prefs_set_bool(PREF_ROOT "/showoffline", + !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); + ret = TRUE; + stop = TRUE; + } if (stop) g_signal_stop_emission_by_name(G_OBJECT(widget), "key_pressed"); Modified: trunk/console/gntui.c =================================================================== --- trunk/console/gntui.c 2006-09-01 11:03:18 UTC (rev 17112) +++ trunk/console/gntui.c 2006-09-01 12:06:51 UTC (rev 17113) @@ -4,10 +4,15 @@ #include "gntblist.h" #include "gntconn.h" #include "gntconv.h" +#include "gntdebug.h" #include "gntnotify.h" #include "gntplugin.h" +#include "gntprefs.h" #include "gntrequest.h" +#include "gntstatus.h" +#include "internal.h" + #include <prefs.h> void init_gnt_ui() @@ -41,7 +46,12 @@ gg_request_init(); gaim_request_set_ui_ops(gg_request_get_ui_ops()); - gg_plugins_show_all(); + gnt_register_action(_("Accounts"), gg_accounts_show_all); + gnt_register_action(_("Buddy List"), gg_blist_show); + gnt_register_action(_("Debug Window"), gg_debug_window_show); + gnt_register_action(_("Plugins"), gg_plugins_show_all); + gnt_register_action(_("Preferences"), gg_prefs_show_all); + gnt_register_action(_("Statuses"), gg_savedstatus_show_all); #ifdef STANDALONE Modified: trunk/console/libgnt/gnt.h =================================================================== --- trunk/console/libgnt/gnt.h 2006-09-01 11:03:18 UTC (rev 17112) +++ trunk/console/libgnt/gnt.h 2006-09-01 12:06:51 UTC (rev 17113) @@ -27,5 +27,7 @@ void gnt_widget_set_urgent(GntWidget *widget); +void gnt_register_action(const char *label, void (*callback)()); + void gnt_quit(); Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-09-01 11:03:18 UTC (rev 17112) +++ trunk/console/libgnt/gntmain.c 2006-09-01 12:06:51 UTC (rev 17113) @@ -46,11 +46,12 @@ static gboolean mouse_enabled; static GMainLoop *loop; + static struct { GntWidget *window; GntWidget *tree; -} window_list; +} _list, *window_list, *action_list; typedef struct { @@ -77,6 +78,8 @@ static gboolean refresh_screen(); static const GList *list_all_windows(); +static void show_actions_list(); + static GntWM wm = { NULL, /* new_window */ @@ -174,9 +177,9 @@ gnt_widget_draw(widget); top_panel(node->panel); - if (window_list.window) + if (_list.window) { - GntNode *nd = g_hash_table_lookup(nodes, window_list.window); + GntNode *nd = g_hash_table_lookup(nodes, _list.window); top_panel(nd->panel); } update_screen(NULL); @@ -188,7 +191,7 @@ { GntTextFormatFlags flag = 0; - if (window_list.window == NULL) + if (window_list == NULL) return; if (wid == ordered->data) @@ -196,7 +199,7 @@ else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT)) flag |= GNT_TEXT_FLAG_BOLD; - gnt_tree_set_row_flags(GNT_TREE(window_list.tree), wid, flag); + gnt_tree_set_row_flags(GNT_TREE(window_list->tree), wid, flag); } static void @@ -327,21 +330,35 @@ } static void +setup__list() +{ + GntWidget *tree, *win; + win = _list.window = gnt_box_new(FALSE, FALSE); + gnt_box_set_toplevel(GNT_BOX(win), TRUE); + gnt_box_set_pad(GNT_BOX(win), 0); + + tree = _list.tree = gnt_tree_new(); + gnt_box_add_widget(GNT_BOX(win), tree); +} + +static void show_window_list() { GntWidget *tree, *win; GList *iter; - if (window_list.window) + if (window_list) return; + + setup__list(); - win = window_list.window = gnt_box_new(FALSE, FALSE); - gnt_box_set_toplevel(GNT_BOX(win), TRUE); + window_list = &_list; + + win = window_list->window; + tree = window_list->tree; + gnt_box_set_title(GNT_BOX(win), "Window List"); - gnt_box_set_pad(GNT_BOX(win), 0); - tree = window_list.tree = gnt_tree_new(); - for (iter = focus_list; iter; iter = iter->next) { GntBox *box = GNT_BOX(iter->data); @@ -352,7 +369,7 @@ } gnt_tree_set_selected(GNT_TREE(tree), ordered->data); - gnt_box_add_widget(GNT_BOX(win), tree); + g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), NULL); gnt_tree_set_col_width(GNT_TREE(tree), 0, getmaxx(stdscr) / 3); gnt_widget_set_size(tree, 0, getmaxy(stdscr) / 2); @@ -361,8 +378,6 @@ lock_focus_list = 1; gnt_widget_show(win); lock_focus_list = 0; - - g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(window_list_activate), NULL); } static void @@ -720,6 +735,11 @@ mode = GNT_KP_MODE_WINDOW_LIST; show_window_list(); } + else if (strcmp(buffer + 1, "a") == 0) + { + mode = GNT_KP_MODE_WINDOW_LIST; + show_actions_list(); + } else if (strcmp(buffer + 1, "r") == 0 && focus_list) { /* Resize window */ @@ -810,18 +830,20 @@ mode = GNT_KP_MODE_NORMAL; } } - else if (mode == GNT_KP_MODE_WINDOW_LIST && window_list.window) + else if (mode == GNT_KP_MODE_WINDOW_LIST && _list.window) { - gnt_widget_key_pressed(window_list.window, buffer); + gnt_widget_key_pressed(_list.window, buffer); if (buffer[0] == '\r' || (buffer[0] == 27 && buffer[1] == 0)) { mode = GNT_KP_MODE_NORMAL; lock_focus_list = 1; - gnt_widget_destroy(window_list.window); - window_list.window = NULL; - window_list.tree = NULL; + gnt_widget_destroy(_list.window); + _list.window = NULL; + _list.tree = NULL; lock_focus_list = 0; + window_list = NULL; + action_list = NULL; } } else if (mode == GNT_KP_MODE_RESIZE) @@ -1054,13 +1076,13 @@ refresh_node(widget, node, NULL); - if (window_list.window) + if (window_list) { - if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && window_list.window != widget + if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && window_list->window != widget && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS)) { - gnt_tree_add_row_last(GNT_TREE(window_list.tree), widget, - gnt_tree_create_row(GNT_TREE(window_list.tree), GNT_BOX(widget)->title), + gnt_tree_add_row_last(GNT_TREE(window_list->tree), widget, + gnt_tree_create_row(GNT_TREE(window_list->tree), GNT_BOX(widget)->title), NULL); update_window_in_list(widget); } @@ -1081,9 +1103,9 @@ g_hash_table_remove(nodes, widget); - if (window_list.window) + if (window_list) { - gnt_tree_remove(GNT_TREE(window_list.tree), widget); + gnt_tree_remove(GNT_TREE(window_list->tree), widget); } update_screen(NULL); @@ -1100,7 +1122,7 @@ node = g_hash_table_lookup(nodes, widget); if (node && !node->panel) { - if (wm.new_window) + if (wm.new_window && node->me != _list.window) node->panel = wm.new_window(node->me); else node->panel = new_panel(node->me->window); @@ -1111,9 +1133,9 @@ } } - if (window_list.window) + if (_list.window) { - GntNode *nd = g_hash_table_lookup(nodes, window_list.window); + GntNode *nd = g_hash_table_lookup(nodes, _list.window); top_panel(nd->panel); } @@ -1131,7 +1153,7 @@ while (widget->parent) widget = widget->parent; - if (widget == window_list.window) + if (widget == _list.window) return TRUE; if (ordered && ordered->data == widget) @@ -1226,3 +1248,74 @@ draw_taskbar(FALSE); } +/** + * An application can register actions which will show up in a 'start-menu' like popup + */ +typedef struct _GnAction +{ + const char *label; + void (*callback)(); +} GntAction; + +static GList *actions; + +void gnt_register_action(const char *label, void (*callback)()) +{ + GntAction *action = g_new0(GntAction, 1); + action->label = g_strdup(label); + action->callback = callback; + + actions = g_list_append(actions, action); +} + +static void +action_list_activate(GntTree *tree, gpointer null) +{ + GntAction *action = gnt_tree_get_selection_data(tree); + action->callback(); +} + +static int +compare_action(gconstpointer p1, gconstpointer p2) +{ + const GntAction *a1 = p1; + const GntAction *a2 = p2; + + return g_utf8_collate(a1->label, a2->label); +} + +static void +show_actions_list() +{ + GntWidget *tree, *win; + GList *iter; + int h; + + if (action_list) + return; + + setup__list(); + action_list = &_list; + win = action_list->window; + tree = action_list->tree; + + gnt_box_set_title(GNT_BOX(win), "Available Actions"); + GNT_WIDGET_SET_FLAGS(tree, GNT_WIDGET_NO_BORDER); + /* XXX: Do we really want this? */ + gnt_tree_set_compare_func(GNT_TREE(tree), compare_action); + + for (iter = actions; iter; iter = iter->next) { + GntAction *action = iter->data; + gnt_tree_add_row_last(GNT_TREE(tree), action, + gnt_tree_create_row(GNT_TREE(tree), action->label), NULL); + } + g_signal_connect(G_OBJECT(tree), "activate", G_CALLBACK(action_list_activate), NULL); + gnt_widget_set_size(tree, 0, g_list_length(actions)); + gnt_widget_get_size(win, NULL, &h); + gnt_widget_set_position(win, 0, getmaxy(stdscr) - 1 - h); + + lock_focus_list = 1; + gnt_widget_show(win); + lock_focus_list = 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-02 19:30:28
|
Revision: 17129 http://svn.sourceforge.net/gaim/?rev=17129&view=rev Author: sadrul Date: 2006-09-02 12:29:06 -0700 (Sat, 02 Sep 2006) Log Message: ----------- Print a "<AUTO-REPLY>" before the autoreply messages. Fix some earlier brain-damaged ifdefs. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/libgnt/gntcolors.c trunk/console/libgnt/gntmain.c trunk/console/libgnt/gntwidget.h trunk/console/libgnt/gntwm.h Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-09-02 18:55:27 UTC (rev 17128) +++ trunk/console/gntconv.c 2006-09-02 19:29:06 UTC (rev 17129) @@ -301,6 +301,10 @@ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM); + if (flags & GAIM_MESSAGE_AUTO_RESP) + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), + _("<AUTO-REPLY> "), GNT_TEXT_FLAG_BOLD); + if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV))) { char * name = NULL; Modified: trunk/console/libgnt/gntcolors.c =================================================================== --- trunk/console/libgnt/gntcolors.c 2006-09-02 18:55:27 UTC (rev 17128) +++ trunk/console/libgnt/gntcolors.c 2006-09-02 19:29:06 UTC (rev 17129) @@ -1,3 +1,5 @@ +#include "config.h" + #ifdef HAVE_NCURSESW_INC #include <ncursesw/ncurses.h> #else Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-09-02 18:55:27 UTC (rev 17128) +++ trunk/console/libgnt/gntmain.c 2006-09-02 19:29:06 UTC (rev 17129) @@ -1,3 +1,5 @@ +#include "config.h" + #ifdef HAVE_NCURSESW_INC #include <ncursesw/panel.h> #else @@ -655,7 +657,7 @@ if (GNT_WIDGET_IS_FLAG_SET(win, GNT_WIDGET_NO_BORDER)) return; - d = dupwin(win->window); + d = win->window; gnt_widget_get_size(win, &w, &h); #define DECIDE(ch) (set ? ((ch) | A_REVERSE) : ((ch) & ~A_REVERSE)) @@ -677,7 +679,6 @@ } wrefresh(win->window); - delwin(d); } static gboolean Modified: trunk/console/libgnt/gntwidget.h =================================================================== --- trunk/console/libgnt/gntwidget.h 2006-09-02 18:55:27 UTC (rev 17128) +++ trunk/console/libgnt/gntwidget.h 2006-09-02 19:29:06 UTC (rev 17129) @@ -1,6 +1,8 @@ #ifndef GNT_WIDGET_H #define GNT_WIDGET_H +#include "config.h" + #include <stdio.h> #include <glib.h> #include <glib-object.h> Modified: trunk/console/libgnt/gntwm.h =================================================================== --- trunk/console/libgnt/gntwm.h 2006-09-02 18:55:27 UTC (rev 17128) +++ trunk/console/libgnt/gntwm.h 2006-09-02 19:29:06 UTC (rev 17129) @@ -1,3 +1,5 @@ +#include "config.h" + #ifdef HAVE_NCURSESW_INC #include <ncursesw/panel.h> #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-02 20:18:01
|
Revision: 17130 http://svn.sourceforge.net/gaim/?rev=17130&view=rev Author: sadrul Date: 2006-09-02 13:17:43 -0700 (Sat, 02 Sep 2006) Log Message: ----------- Show the accounts-dialog at startup if there's no enabled account. Modified Paths: -------------- trunk/console/gntaccount.c trunk/console/libgnt/wms/s.c Modified: trunk/console/gntaccount.c =================================================================== --- trunk/console/gntaccount.c 2006-09-02 19:29:06 UTC (rev 17129) +++ trunk/console/gntaccount.c 2006-09-02 20:17:43 UTC (rev 17130) @@ -693,6 +693,8 @@ void gg_accounts_init() { + GList *iter; + gaim_signal_connect(gaim_accounts_get_handle(), "account-added", gg_accounts_get_handle(), GAIM_CALLBACK(account_added_callback), NULL); @@ -700,7 +702,12 @@ gg_accounts_get_handle(), GAIM_CALLBACK(account_removed_callback), NULL); - gg_accounts_show_all(); + for (iter = gaim_accounts_get_all(); iter; iter = iter->next) { + if (gaim_account_get_enabled(iter->data, GAIM_GNT_UI)) + break; + } + if (!iter) + gg_accounts_show_all(); } void gg_accounts_uninit() Modified: trunk/console/libgnt/wms/s.c =================================================================== --- trunk/console/libgnt/wms/s.c 2006-09-02 19:29:06 UTC (rev 17129) +++ trunk/console/libgnt/wms/s.c 2006-09-02 20:17:43 UTC (rev 17130) @@ -14,6 +14,7 @@ gnt_widget_get_size(win, &w, &h); wresize(win->window, h, w + 1); mvwvline(win->window, 0, w, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), h); + touchwin(win->window); } static void This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-09-03 18:41:20
|
Revision: 17140 http://svn.sourceforge.net/gaim/?rev=17140&view=rev Author: amc_grim Date: 2006-09-03 11:41:14 -0700 (Sun, 03 Sep 2006) Log Message: ----------- Adjust more svn:ignore's... Property Changed: ---------------- trunk/console/ trunk/console/libgnt/ Property changes on: trunk/console ___________________________________________________________________ Name: svn:ignore - Makefile.in gmon.out gntgaim .libs .deps Makefile .error + Makefile.in gmon.out gntgaim .libs .deps Makefile .error *.o Property changes on: trunk/console/libgnt ___________________________________________________________________ Name: svn:ignore - .deps gnt.pc .libs Makefile Makefile.in + .deps gnt.pc .libs Makefile Makefile.in *.dll *.la *.lo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <amc...@us...> - 2006-09-04 03:58:30
|
Revision: 17151 http://svn.sourceforge.net/gaim/?rev=17151&view=rev Author: amc_grim Date: 2006-09-03 20:58:23 -0700 (Sun, 03 Sep 2006) Log Message: ----------- A patch from John Bailey to get gntgaim compiling for him, although we're both running debian and it worked fine here... Well whatever, doesn't hurt my build ;) Modified Paths: -------------- trunk/console/libgnt/wms/Makefile.am trunk/console/plugins/Makefile.am Modified: trunk/console/libgnt/wms/Makefile.am =================================================================== --- trunk/console/libgnt/wms/Makefile.am 2006-09-04 03:55:12 UTC (rev 17150) +++ trunk/console/libgnt/wms/Makefile.am 2006-09-04 03:58:23 UTC (rev 17151) @@ -17,5 +17,6 @@ -I$(top_srcdir)/console/libgnt \ $(DEBUG_CFLAGS) \ $(GLIB_CFLAGS) \ + $(GNT_CFLAGS) \ $(PLUGIN_CFLAGS) Modified: trunk/console/plugins/Makefile.am =================================================================== --- trunk/console/plugins/Makefile.am 2006-09-04 03:55:12 UTC (rev 17150) +++ trunk/console/plugins/Makefile.am 2006-09-04 03:58:23 UTC (rev 17151) @@ -25,6 +25,7 @@ -I$(top_srcdir)/console/libgnt \ $(DEBUG_CFLAGS) \ $(GLIB_CFLAGS) \ + $(GNT_CFLAGS) \ $(PLUGIN_CFLAGS) # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-10 00:18:04
|
Revision: 17212 http://svn.sourceforge.net/gaim/?rev=17212&view=rev Author: sadrul Date: 2006-09-09 17:17:44 -0700 (Sat, 09 Sep 2006) Log Message: ----------- Update the statuslist with appropriate list of stauses in the buddylist when global status is changed. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gntcombobox.c trunk/console/libgnt/gntcombobox.h trunk/console/libgnt/gntmain.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-09-09 21:58:04 UTC (rev 17211) +++ trunk/console/gntblist.c 2006-09-10 00:17:44 UTC (rev 17212) @@ -1317,6 +1317,8 @@ GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY, GAIM_STATUS_INVISIBLE, GAIM_STATUS_OFFLINE, GAIM_STATUS_UNSET}; + gnt_combo_box_remove_all(GNT_COMBO_BOX(ggblist->status)); + for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++) { item = g_new0(StatusBoxItem, 1); @@ -1492,7 +1494,6 @@ static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old) { - /* Block the signals we don't want to emit */ GList *list; GaimStatusPrimitive prim; const char *message; @@ -1500,6 +1501,7 @@ if (!ggblist) return; + /* Block the signals we don't want to emit */ g_signal_handlers_block_matched(ggblist->status, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, status_selection_changed, NULL); g_signal_handlers_block_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC, @@ -1508,6 +1510,9 @@ prim = gaim_savedstatus_get_type(now); message = gaim_savedstatus_get_message(now); + /* Rebuild the status dropdown */ + populate_status_dropdown(); + list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses"); for (; list; list = list->next) { @@ -1610,8 +1615,6 @@ ggblist->statustext = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext); - populate_status_dropdown(); - gnt_widget_show(ggblist->window); gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), Modified: trunk/console/libgnt/gntcombobox.c =================================================================== --- trunk/console/libgnt/gntcombobox.c 2006-09-09 21:58:04 UTC (rev 17211) +++ trunk/console/libgnt/gntcombobox.c 2006-09-10 00:17:44 UTC (rev 17212) @@ -287,3 +287,16 @@ set_selection(box, key); } +void gnt_combo_box_remove(GntComboBox *box, gpointer key) +{ + gnt_tree_remove(GNT_TREE(box->dropdown), key); + if (box->selected == key) + set_selection(box, NULL); +} + +void gnt_combo_box_remove_all(GntComboBox *box) +{ + gnt_tree_remove_all(GNT_TREE(box->dropdown)); + set_selection(box, NULL); +} + Modified: trunk/console/libgnt/gntcombobox.h =================================================================== --- trunk/console/libgnt/gntcombobox.h 2006-09-09 21:58:04 UTC (rev 17211) +++ trunk/console/libgnt/gntcombobox.h 2006-09-10 00:17:44 UTC (rev 17212) @@ -48,6 +48,10 @@ void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text); +void gnt_combo_box_remove(GntComboBox *box, gpointer key); + +void gnt_combo_box_remove_all(GntComboBox *box); + gpointer gnt_combo_box_get_selected_data(GntComboBox *box); void gnt_combo_box_set_selected(GntComboBox *box, gpointer key); Modified: trunk/console/libgnt/gntmain.c =================================================================== --- trunk/console/libgnt/gntmain.c 2006-09-09 21:58:04 UTC (rev 17211) +++ trunk/console/libgnt/gntmain.c 2006-09-10 00:17:44 UTC (rev 17212) @@ -577,8 +577,6 @@ x -= 33; y -= 33; - /* It might be a better idea to use panel_below. That would allow mouse-clicks - * to be operated on transient windows, which would be cool.*/ while ((p = panel_below(p)) != NULL) { const GntNode *node = panel_userptr(p); GntWidget *wid; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-15 01:22:09
|
Revision: 17281 http://svn.sourceforge.net/gaim/?rev=17281&view=rev Author: sadrul Date: 2006-09-14 18:21:53 -0700 (Thu, 14 Sep 2006) Log Message: ----------- Doxygen for console/ Modified Paths: -------------- trunk/console/gntaccount.c trunk/console/gntaccount.h trunk/console/gntblist.c trunk/console/gntblist.h trunk/console/gntconn.c trunk/console/gntconn.h trunk/console/gntconv.c trunk/console/gntconv.h trunk/console/gntdebug.c trunk/console/gntdebug.h trunk/console/gntgaim.c trunk/console/gntgaim.h trunk/console/gntnotify.c trunk/console/gntnotify.h trunk/console/gntplugin.c trunk/console/gntplugin.h trunk/console/gntprefs.c trunk/console/gntprefs.h trunk/console/gntrequest.c trunk/console/gntrequest.h trunk/console/gntstatus.c trunk/console/gntstatus.h trunk/console/gntui.c trunk/console/gntui.h Modified: trunk/console/gntaccount.c =================================================================== --- trunk/console/gntaccount.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntaccount.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntaccount.c GNT Account API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> Modified: trunk/console/gntaccount.h =================================================================== --- trunk/console/gntaccount.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntaccount.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntaccount.h GNT Account API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_ACCOUNT_H #define _GNT_ACCOUNT_H @@ -3,11 +27,32 @@ #include "account.h" +/********************************************************************** + * @name GNT Account API + **********************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimAccountUiOps structure populated with the appropriate functions. + */ GaimAccountUiOps *gg_accounts_get_ui_ops(void); +/** + * Perform necessary initializations. + */ void gg_accounts_init(void); +/** + * Perform necessary uninitializations. + */ void gg_accounts_uninit(void); +/** + * Show the account-manager dialog. + */ void gg_accounts_show_all(void); +/*@}*/ + #endif Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntblist.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntblist.c GNT BuddyList API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <account.h> #include <blist.h> #include <notify.h> Modified: trunk/console/gntblist.h =================================================================== --- trunk/console/gntblist.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntblist.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntblist.h GNT BuddyList API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_BLIST_H #define _GNT_BLIST_H @@ -3,19 +27,68 @@ #include "blist.h" +/********************************************************************** + * @name GNT BuddyList API + **********************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimBlistUiOps structure populated with the appropriate functions. + */ GaimBlistUiOps * gg_blist_get_ui_ops(void); +/** + * Perform necessary initializations. + */ void gg_blist_init(void); +/** + * Perform necessary uninitializations. + */ void gg_blist_uninit(void); +/** + * Show the buddy list. + */ void gg_blist_show(void); +/** + * Get the position of the buddy list. + * + * @param x The x-coordinate is set here if not @ NULL. + * @param y The y-coordinate is set here if not @c NULL. + * + * @return Returns @c TRUE if the values were set, @c FALSE otherwise. + */ gboolean gg_blist_get_position(int *x, int *y); +/** + * Set the position of the buddy list. + * + * @param x The x-coordinate of the buddy list. + * @param y The y-coordinate of the buddy list. + */ void gg_blist_set_position(int x, int y); +/** + * Get the size of the buddy list. + * + * @param width The width is set here if not @ NULL. + * @param height The height is set here if not @c NULL. + * + * @return Returns @c TRUE if the values were set, @c FALSE otherwise. + */ gboolean gg_blist_get_size(int *width, int *height); +/** + * Set the size of the buddy list. + * + * @param width The width of the buddy list. + * @param height The height of the buddy list. + */ void gg_blist_set_size(int width, int height); +/*@}*/ + #endif Modified: trunk/console/gntconn.c =================================================================== --- trunk/console/gntconn.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntconn.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntconn.c GNT Connection API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include "notify.h" #include "gntconn.h" Modified: trunk/console/gntconn.h =================================================================== --- trunk/console/gntconn.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntconn.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntconn.h GNT Connection API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_CONN_H #define _GNT_CONN_H @@ -3,9 +27,27 @@ #include "connection.h" +/********************************************************************** + * @name GNT Connection API + **********************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimConnectionUiOps structure populated with the appropriate functions. + */ GaimConnectionUiOps *gg_connections_get_ui_ops(void); +/** + * Perform necessary initializations. + */ void gg_connections_init(void); +/** + * Perform necessary uninitializations. + */ void gg_connections_uninit(void); +/*@}*/ + #endif Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntconv.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntconv.c GNT Conversation API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <string.h> #include <cmds.h> Modified: trunk/console/gntconv.h =================================================================== --- trunk/console/gntconv.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntconv.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntconv.h GNT Conversation API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_CONV_H #define _GNT_CONV_H @@ -3,12 +27,34 @@ #include "conversation.h" +/*************************************************************************** + * @name GNT Conversations API + ***************************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimConversationUiOps populated with the appropriate functions. + */ GaimConversationUiOps *gg_conv_get_ui_ops(void); +/** + * Perform the necessary initializations. + */ void gg_conversation_init(void); +/** + * Perform the necessary uninitializations. + */ void gg_conversation_uninit(void); -/* Set a conversation as active in a contactized conversation */ +/** + * Set a conversation as active in a contactized conversation + * + * @param conv The conversation to make active. + */ void gg_conversation_set_active(GaimConversation *conv); +/*@}*/ + #endif Modified: trunk/console/gntdebug.c =================================================================== --- trunk/console/gntdebug.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntdebug.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntdebug.c GNT Debug API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <gnt.h> #include <gntbox.h> #include <gnttextview.h> Modified: trunk/console/gntdebug.h =================================================================== --- trunk/console/gntdebug.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntdebug.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntdebug.h GNT Debug API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_DEBUG_H #define _GNT_DEBUG_H @@ -3,11 +27,32 @@ #include "debug.h" +/********************************************************************** + * @name GNT Debug API + **********************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimDebugUiOps structure populated with the appropriate functions. + */ GaimDebugUiOps *gg_debug_get_ui_ops(void); +/** + * Perform necessary initializations. + */ void gg_debug_init(void); +/** + * Perform necessary uninitializations. + */ void gg_debug_uninit(void); +/** + * Show the debug window. + */ void gg_debug_window_show(void); +/*@}*/ + #endif Modified: trunk/console/gntgaim.c =================================================================== --- trunk/console/gntgaim.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntgaim.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,24 @@ +/** + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include "account.h" #include "conversation.h" #include "core.h" Modified: trunk/console/gntgaim.h =================================================================== --- trunk/console/gntgaim.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntgaim.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,24 @@ +/** + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <glib.h> #include "libgaim/internal.h" Modified: trunk/console/gntnotify.c =================================================================== --- trunk/console/gntnotify.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntnotify.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntnotify.c GNT Notify API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> Modified: trunk/console/gntnotify.h =================================================================== --- trunk/console/gntnotify.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntnotify.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntnotify.h GNT Notify API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_NOTIFY_H #define _GNT_NOTIFY_H @@ -3,10 +27,28 @@ #include "notify.h" +/********************************************************************** + * @name GNT Notify API + **********************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimNotifyUiOps structure populated with the appropriate functions. + */ GaimNotifyUiOps *gg_notify_get_ui_ops(void); +/** + * Perform necessary initializations. + */ void gg_notify_init(void); +/** + * Perform necessary uninitializations. + */ void gg_notify_uninit(void); +/*@}*/ + #endif Modified: trunk/console/gntplugin.c =================================================================== --- trunk/console/gntplugin.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntplugin.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntplugin.c GNT Plugins API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> Modified: trunk/console/gntplugin.h =================================================================== --- trunk/console/gntplugin.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntplugin.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntplugin.h GNT Plugins API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_PLUGIN_H #define _GNT_PLUGIN_H @@ -7,20 +31,39 @@ #include <string.h> +/********************************************************************** + * @name GNT Plugins API + **********************************************************************/ +/*@{*/ + typedef GntWidget* (*GGPluginFrame) (); /* Guess where these came from */ #define GAIM_GNT_PLUGIN_TYPE "gnt" +/** + * Decide whether a plugin is a GNT-plugin. + */ #define GAIM_IS_GNT_PLUGIN(plugin) \ ((plugin)->info != NULL && (plugin)->info->ui_info != NULL && \ !strcmp((plugin)->info->ui_requirement, GAIM_GNT_PLUGIN_TYPE)) +/** + * Get the ui-info from GNT-plugins. + */ #define GAIM_GNT_PLUGIN_UI_INFO(plugin) \ (GGPluginFrame)((plugin)->info->ui_info) +/** + * Show a list of plugins. + */ void gg_plugins_show_all(void); +/** + * Save the list of loaded plugins. + */ void gg_plugins_save_loaded(void); +/*@}*/ + #endif Modified: trunk/console/gntprefs.c =================================================================== --- trunk/console/gntprefs.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntprefs.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntprefs.c GNT Preferences API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <prefs.h> #include "gntgaim.h" Modified: trunk/console/gntprefs.h =================================================================== --- trunk/console/gntprefs.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntprefs.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,8 +1,45 @@ +/** + * @file gntprefs.h GNT Preferences API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_PREFS_H #define _GNT_PREFS_H +/********************************************************************** + * @name GNT Preferences API + **********************************************************************/ +/*@{*/ + +/** + * Perform necessary initializations. + */ void gg_prefs_init(void); +/** + * Show the preferences dialog. + */ void gg_prefs_show_all(void); +/*@}*/ + #endif Modified: trunk/console/gntrequest.c =================================================================== --- trunk/console/gntrequest.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntrequest.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntrequest.c GNT Request API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> Modified: trunk/console/gntrequest.h =================================================================== --- trunk/console/gntrequest.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntrequest.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntrequest.h GNT Request API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_REQUEST_H #define _GNT_REQUEST_H @@ -3,9 +27,27 @@ #include "request.h" +/********************************************************************** + * @name GNT Request API + **********************************************************************/ +/*@{*/ + +/** + * Get the ui-functions. + * + * @return The GaimRequestUiOps structure populated with the appropriate functions. + */ GaimRequestUiOps *gg_request_get_ui_ops(void); +/** + * Perform necessary initializations. + */ void gg_request_init(void); +/** + * Perform necessary uninitializations. + */ void gg_request_uninit(void); +/*@}*/ + #endif Modified: trunk/console/gntstatus.c =================================================================== --- trunk/console/gntstatus.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntstatus.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntstatus.c GNT Status API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include <gnt.h> #include <gntbox.h> #include <gntbutton.h> Modified: trunk/console/gntstatus.h =================================================================== --- trunk/console/gntstatus.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntstatus.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,27 @@ +/** + * @file gntstatus.h GNT Status API + * @ingroup gntui + * + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_STATUS_H #define _GNT_STATUS_H @@ -4,8 +28,23 @@ #include <status.h> #include <savedstatuses.h> +/********************************************************************** + * @name GNT BuddyList API + **********************************************************************/ +/*@{*/ + +/** + * Show a dialog with all the saved statuses. + */ void gg_savedstatus_show_all(void); +/** + * Show a dialog to edit a status. + * + * @param saved The saved status to edit. Set it to @c NULL to create a new status. + */ void gg_savedstatus_edit(GaimSavedStatus *saved); +/*@}*/ + #endif Modified: trunk/console/gntui.c =================================================================== --- trunk/console/gntui.c 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntui.c 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,24 @@ +/** + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #include "gntui.h" #include "gntaccount.h" Modified: trunk/console/gntui.h =================================================================== --- trunk/console/gntui.h 2006-09-14 22:21:52 UTC (rev 17280) +++ trunk/console/gntui.h 2006-09-15 01:21:53 UTC (rev 17281) @@ -1,3 +1,24 @@ +/** + * gaim + * + * Gaim is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * source distribution. + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ #ifndef _GNT_UI_H #define _GNT_UI_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-09-24 17:07:45
|
Revision: 17344 http://svn.sourceforge.net/gaim/?rev=17344&view=rev Author: sadrul Date: 2006-09-24 10:07:38 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Add a barebone menu in the buddylist for account actions. (Press Ctrl+o) Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gntmenu.c trunk/console/libgnt/gntmenuitem.c trunk/console/libgnt/gntmenuitem.h trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h trunk/console/libgnt/gntwindow.c trunk/console/libgnt/test/menu.c Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/gntblist.c 2006-09-24 17:07:38 UTC (rev 17344) @@ -39,6 +39,7 @@ #include "gntlabel.h" #include "gntline.h" #include "gnttree.h" +#include "gntwindow.h" #include "gntblist.h" #include "gntconv.h" @@ -483,6 +484,8 @@ gnt_tree_create_row(GNT_TREE(ggblist->tree), get_display_name(node)), group, NULL); + /* XXX: This causes problem because you can close a chat window, hide the buddylist. + * When you show the buddylist, you automatically join the chat again. */ if (gaim_blist_node_get_bool((GaimBlistNode*)chat, "gnt-autojoin")) serv_join_chat(gaim_account_get_connection(chat->account), chat->components); } @@ -1608,6 +1611,75 @@ return FALSE; } +static void +plugin_action(GntMenuItem *item, gpointer data) +{ + GaimPluginAction *action = data; + if (action && action->callback) + action->callback(action); +} + +static void +reconstruct_accounts_menu() +{ + GntWidget *menu, *sub; + GntMenuItem *item; + GntWindow *window; + GList *iter; + + if (!ggblist) + return; + + window = GNT_WINDOW(ggblist->window); + + menu = gnt_menu_new(GNT_MENU_TOPLEVEL); + gnt_window_set_menu(window, GNT_MENU(menu)); + + item = gnt_menuitem_new(_("Accounts")); + gnt_menu_add_item(GNT_MENU(menu), item); + + sub = gnt_menu_new(GNT_MENU_POPUP); + gnt_menuitem_set_submenu(item, GNT_MENU(sub)); + + for (iter = gaim_accounts_get_all_active(); iter; + iter = g_list_delete_link(iter, iter)) { + GaimAccount *account = iter->data; + GaimConnection *gc = gaim_account_get_connection(account); + GaimPlugin *prpl; + + if (!GAIM_CONNECTION_IS_CONNECTED(gc)) + continue; + prpl = gc->prpl; + + if (GAIM_PLUGIN_HAS_ACTIONS(prpl)) { + GList *acts; + GntWidget *s; + + item = gnt_menuitem_new(gaim_account_get_username(account)); + s = gnt_menu_new(GNT_MENU_POPUP); + gnt_menuitem_set_submenu(item, GNT_MENU(s)); + gnt_menu_add_item(GNT_MENU(sub), item); + + for (acts = GAIM_PLUGIN_ACTIONS(prpl, gc); acts; + acts = g_list_delete_link(acts, acts)) { + GaimPluginAction *action = acts->data; + if (!action) + continue; + + action->plugin = prpl; + action->context = gc; + + item = gnt_menuitem_new(action->label); + gnt_menuitem_set_callback(item, plugin_action, action); + /* This is to make sure the action is freed when the menu is destroyed */ + g_object_set_data_full(G_OBJECT(item), "plugin_action", action, + (GDestroyNotify)gaim_plugin_action_free); + gnt_menu_add_item(GNT_MENU(s), item); + } + } + } +} + void gg_blist_show() { if (ggblist) @@ -1617,7 +1689,7 @@ gaim_get_blist()->ui_data = ggblist; - ggblist->window = gnt_vbox_new(FALSE); + ggblist->window = gnt_vwindow_new(FALSE); gnt_widget_set_name(ggblist->window, "buddylist"); gnt_box_set_toplevel(GNT_BOX(ggblist->window), TRUE); gnt_box_set_title(GNT_BOX(ggblist->window), _("Buddy List")); @@ -1641,6 +1713,10 @@ gnt_widget_show(ggblist->window); + gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gg_blist_get_handle(), + GAIM_CALLBACK(reconstruct_accounts_menu), NULL); + gaim_signal_connect(gaim_connections_get_handle(), "signed-off", gg_blist_get_handle(), + GAIM_CALLBACK(reconstruct_accounts_menu), NULL); gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), GAIM_CALLBACK(buddy_status_changed), ggblist); gaim_signal_connect(gaim_blist_get_handle(), "buddy-idle-changed", gg_blist_get_handle(), @@ -1682,6 +1758,8 @@ g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", G_CALLBACK(status_text_changed), NULL); + reconstruct_accounts_menu(ggblist); + populate_buddylist(); savedstatus_changed(gaim_savedstatus_get_current(), NULL); Modified: trunk/console/libgnt/gntmenu.c =================================================================== --- trunk/console/libgnt/gntmenu.c 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/gntmenu.c 2006-09-24 17:07:38 UTC (rev 17344) @@ -10,10 +10,10 @@ static GntTreeClass *parent_class = NULL; static guint signals[SIGS] = { 0 }; -void (*org_draw)(GntWidget *wid); -void (*org_destroy)(GntWidget *wid); -void (*org_map)(GntWidget *wid); -gboolean (*org_key_pressed)(GntWidget *w, const char *t); +static void (*org_draw)(GntWidget *wid); +static void (*org_destroy)(GntWidget *wid); +static void (*org_map)(GntWidget *wid); +static gboolean (*org_key_pressed)(GntWidget *w, const char *t); static void gnt_menu_draw(GntWidget *widget) @@ -89,6 +89,7 @@ menu_tree_add(menu, item, NULL); } org_map(widget); + gnt_tree_adjust_columns(GNT_TREE(widget)); } GNTDEBUG; } @@ -267,7 +268,7 @@ GntWidget *widget = g_object_new(GNT_TYPE_MENU, NULL); GntMenu *menu = GNT_MENU(widget); menu->list = NULL; - menu->selected = -1; + menu->selected = 0; menu->type = type; if (type == GNT_MENU_TOPLEVEL) { Modified: trunk/console/libgnt/gntmenuitem.c =================================================================== --- trunk/console/libgnt/gntmenuitem.c 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/gntmenuitem.c 2006-09-24 17:07:38 UTC (rev 17344) @@ -56,14 +56,14 @@ return type; } -GObject *gnt_menuitem_new(const char *text) +GntMenuItem *gnt_menuitem_new(const char *text) { GObject *item = g_object_new(GNT_TYPE_MENUITEM, NULL); GntMenuItem *menuitem = GNT_MENUITEM(item); menuitem->text = g_strdup(text); - return item; + return menuitem; } void gnt_menuitem_set_callback(GntMenuItem *item, GntMenuItemCallback callback, gpointer data) Modified: trunk/console/libgnt/gntmenuitem.h =================================================================== --- trunk/console/libgnt/gntmenuitem.h 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/gntmenuitem.h 2006-09-24 17:07:38 UTC (rev 17344) @@ -58,7 +58,7 @@ GType gnt_menuitem_get_gtype(void); -GObject *gnt_menuitem_new(const char *text); +GntMenuItem *gnt_menuitem_new(const char *text); void gnt_menuitem_set_callback(GntMenuItem *item, GntMenuItemCallback callback, gpointer data); Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/gnttree.c 2006-09-24 17:07:38 UTC (rev 17344) @@ -1,5 +1,6 @@ #include "gnttree.h" #include "gntmarshal.h" +#include "gntutils.h" #include <string.h> #include <ctype.h> @@ -1140,6 +1141,7 @@ { tree->columns[col].width = 15; } + tree->list = NULL; tree->show_title = FALSE; } @@ -1241,3 +1243,33 @@ tree->show_separator = set; } +void gnt_tree_adjust_columns(GntTree *tree) +{ + GntTreeRow *row = tree->root; + int *widths, i, twidth, height; + + widths = g_new0(int, tree->ncol); + while (row) { + GList *iter; + for (i = 0, iter = row->columns; iter; iter = iter->next, i++) { + GntTreeCol *col = iter->data; + int w = gnt_util_onscreen_width(col->text, NULL); + if (widths[i] < w) + widths[i] = w; + } + row = row->next; + } + + 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]); + twidth += widths[i] + (tree->show_separator ? 1 : 0) + 1; + fprintf(stderr, "column width for col %d: %d\n", i, widths[i]); + } + g_free(widths); + + fprintf(stderr, "tree width: %d\n", twidth); + gnt_widget_get_size(GNT_WIDGET(tree), NULL, &height); + gnt_widget_set_size(GNT_WIDGET(tree), twidth, height); +} + Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/gnttree.h 2006-09-24 17:07:38 UTC (rev 17344) @@ -123,6 +123,9 @@ void gnt_tree_set_show_separator(GntTree *tree, gboolean set); +/* This will try to automatically adjust the width of the columns in the tree */ +void gnt_tree_adjust_columns(GntTree *tree); + G_END_DECLS /* The following functions should NOT be used by applications. */ Modified: trunk/console/libgnt/gntwindow.c =================================================================== --- trunk/console/libgnt/gntwindow.c 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/gntwindow.c 2006-09-24 17:07:38 UTC (rev 17344) @@ -10,8 +10,8 @@ static GntBoxClass *parent_class = NULL; static guint signals[SIGS] = { 0 }; -gboolean (*org_keypress)(GntWidget *widget, const char *text); -void (*org_destroy)(GntWidget *widget); +static gboolean (*org_keypress)(GntWidget *widget, const char *text); +static void (*org_destroy)(GntWidget *widget); static gboolean gnt_window_key_pressed(GntWidget *widget, const char *text) @@ -108,6 +108,9 @@ void gnt_window_set_menu(GntWindow *window, GntMenu *menu) { + /* If a menu already existed, then destroy that first. */ + if (window->menu) + gnt_widget_destroy(GNT_WIDGET(window->menu)); window->menu = menu; } Modified: trunk/console/libgnt/test/menu.c =================================================================== --- trunk/console/libgnt/test/menu.c 2006-09-24 16:35:31 UTC (rev 17343) +++ trunk/console/libgnt/test/menu.c 2006-09-24 17:07:38 UTC (rev 17344) @@ -48,7 +48,6 @@ gnt_screen_menu_show(menu); - GntWidget *win = gnt_window_new(); gnt_box_add_widget(GNT_BOX(win), gnt_label_new("...")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-10-08 03:56:11
|
Revision: 17445 http://svn.sourceforge.net/gaim/?rev=17445&view=rev Author: sadrul Date: 2006-10-07 20:56:06 -0700 (Sat, 07 Oct 2006) Log Message: ----------- Patch #1569730 from Richard Nelson (wabz): "This patch adds a "Clear" button, timestamp and pause options, and stops it scrolling down if it's scrolled up." and "Also gives the debug window a name, so window managers can more easily have their way with it." These changes make the debug window a whole lot more usable. Modified Paths: -------------- trunk/console/gntdebug.c trunk/console/libgnt/gntcheckbox.c Modified: trunk/console/gntdebug.c =================================================================== --- trunk/console/gntdebug.c 2006-10-07 18:19:17 UTC (rev 17444) +++ trunk/console/gntdebug.c 2006-10-08 03:56:06 UTC (rev 17445) @@ -25,9 +25,13 @@ #include <gnt.h> #include <gntbox.h> #include <gnttextview.h> +#include <gntbutton.h> +#include <gntcheckbox.h> +#include <gntline.h> #include "gntdebug.h" #include "gntgaim.h" +#include "util.h" #include <stdio.h> #include <string.h> @@ -36,6 +40,8 @@ { GntWidget *window; GntWidget *tview; + gboolean paused; + gboolean timestamps; } debug; static gboolean @@ -62,15 +68,24 @@ gg_debug_print(GaimDebugLevel level, const char *category, const char *args) { - if (debug.window) + if (debug.window && !debug.paused) { + int pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(debug.tview)); GntTextFormatFlags flag = GNT_TEXT_FLAG_NORMAL; + if (debug.timestamps) { + const char *mdate; + time_t mtime = time(NULL); + mdate = gaim_utf8_strftime("%H:%M:%S ", localtime(&mtime)); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), + mdate, flag); + } + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), category, GNT_TEXT_FLAG_BOLD); gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), ": ", GNT_TEXT_FLAG_BOLD); - + switch (level) { case GAIM_DEBUG_WARNING: @@ -82,13 +97,14 @@ default: break; } - + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(debug.tview), args, flag); - gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); + if (pos <= 1) + gnt_text_view_scroll(GNT_TEXT_VIEW(debug.tview), 0); } } -static GaimDebugUiOps uiops = +static GaimDebugUiOps uiops = { gg_debug_print, }; @@ -105,24 +121,76 @@ } static void +clear_debug_win(GntWidget *w, GntTextView *tv) +{ + gnt_text_view_clear(tv); +} + +static void print_stderr(const char *string) { g_printerr("%s", string); } +static void +toggle_pause(GntWidget *w, gpointer n) +{ + debug.paused = !debug.paused; +} + +static void +toggle_timestamps(GntWidget *w, gpointer n) +{ + debug.timestamps = !debug.timestamps; + gaim_prefs_set_bool("/core/debug/timestamps", debug.timestamps); +} + void gg_debug_window_show() { + debug.paused = false; + debug.timestamps = gaim_prefs_get_bool("/core/debug/timestamps"); if (debug.window == NULL) { + GntWidget *wid, *box; debug.window = gnt_vbox_new(FALSE); gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); + gnt_box_set_pad(GNT_BOX(debug.window), 0); + gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID); debug.tview = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); - /* XXX: Add checkboxes/buttons for Clear, Pause, Timestamps */ + gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE)); + box = gnt_hbox_new(FALSE); + gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); + + /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now + * it's necessary to make the width of the debug window resizable ... like I said, + * it doesn't make sense. The bug is likely in the packing in gntbox.c. + */ + wid = gnt_button_new(_("Clear")); + g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); + GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); + gnt_box_add_widget(GNT_BOX(box), wid); + + wid = gnt_check_box_new(_("Pause")); + g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); + GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); + gnt_box_add_widget(GNT_BOX(box), wid); + + wid = gnt_check_box_new(_("Timestamps")); + gnt_check_box_set_checked(GNT_CHECK_BOX(wid), debug.timestamps); + g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_timestamps), NULL); + GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); + gnt_box_add_widget(GNT_BOX(box), wid); + + gnt_box_add_widget(GNT_BOX(debug.window), box); + GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); + + gnt_widget_set_name(debug.window, "debug-window"); + g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); g_signal_connect(G_OBJECT(debug.window), "key_pressed", G_CALLBACK(debug_window_kpress_cb), debug.tview); } Modified: trunk/console/libgnt/gntcheckbox.c =================================================================== --- trunk/console/libgnt/gntcheckbox.c 2006-10-07 18:19:17 UTC (rev 17444) +++ trunk/console/libgnt/gntcheckbox.c 2006-10-08 03:56:06 UTC (rev 17445) @@ -108,7 +108,10 @@ static void gnt_check_box_init(GTypeInstance *instance, gpointer class) { - GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); + GntWidget *widget = GNT_WIDGET(instance); + widget->priv.minh = 1; + widget->priv.minw = 4; + GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); GNTDEBUG; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-10-12 03:26:39
|
Revision: 17466 http://svn.sourceforge.net/gaim/?rev=17466&view=rev Author: sadrul Date: 2006-10-11 20:26:33 -0700 (Wed, 11 Oct 2006) Log Message: ----------- Patch #1573404 from Richard Nelson (wabz): "This patch keeps the blist sorted (sorts rows at the current depth when the text for a given row changes). Adds a menu "Options" to the blist and adds the options to sort by status, alphabetically and toggle offline buddies." I changed some of the stuff from the patch. Hopefully I didn't break anything. I also added a "Sort by log size" option. Modified Paths: -------------- trunk/console/gntblist.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h Modified: trunk/console/gntblist.c =================================================================== --- trunk/console/gntblist.c 2006-10-12 02:51:52 UTC (rev 17465) +++ trunk/console/gntblist.c 2006-10-12 03:26:33 UTC (rev 17466) @@ -99,6 +99,11 @@ static const char * get_display_name(GaimBlistNode *node); static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old); +/* Sort functions */ +static int blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2); +static int blist_node_compare_status(GaimBlistNode *n1, GaimBlistNode *n2); +static int blist_node_compare_log(GaimBlistNode *n1, GaimBlistNode *n2); + static gboolean is_contact_online(GaimContact *contact) { @@ -188,6 +193,7 @@ if (node->ui_data != NULL) { gnt_tree_change_text(GNT_TREE(ggblist->tree), node, 0, get_display_name(node)); + gnt_tree_sort_row(GNT_TREE(ggblist->tree), node); } if (GAIM_BLIST_NODE_IS_BUDDY(node)) { @@ -1375,6 +1381,17 @@ GaimBlistNode *node; GaimBuddyList *list; + if (strcmp(gaim_prefs_get_string(PREF_ROOT "/sort_type"), "text") == 0) { + gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), + (GCompareFunc)blist_node_compare_text); + } else if (strcmp(gaim_prefs_get_string(PREF_ROOT "/sort_type"), "status") == 0) { + gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), + (GCompareFunc)blist_node_compare_status); + } else if (strcmp(gaim_prefs_get_string(PREF_ROOT "/sort_type"), "log") == 0) { + gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), + (GCompareFunc)blist_node_compare_log); + } + list = gaim_get_blist(); node = gaim_blist_get_root(); while (node) @@ -1475,11 +1492,14 @@ gaim_prefs_add_int(PREF_ROOT "/position/y", 0); gaim_prefs_add_bool(PREF_ROOT "/idletime", TRUE); gaim_prefs_add_bool(PREF_ROOT "/showoffline", FALSE); + gaim_prefs_add_string(PREF_ROOT "/sort_type", "text"); gg_blist_show(); gaim_prefs_connect_callback(gg_blist_get_handle(), PREF_ROOT "/showoffline", redraw_blist, NULL); + gaim_prefs_connect_callback(gg_blist_get_handle(), + PREF_ROOT "/sort_type", redraw_blist, NULL); return; } @@ -1621,7 +1641,7 @@ } static int -blist_node_compare(GaimBlistNode *n1, GaimBlistNode *n2) +blist_node_compare_text(GaimBlistNode *n1, GaimBlistNode *n2) { const char *s1, *s2; char *us1, *us2; @@ -1640,7 +1660,6 @@ s2 = gaim_chat_get_name((GaimChat*)n2); break; case GAIM_BLIST_BUDDY_NODE: - /* XXX: reordering existing rows don't do well in GntTree */ return gaim_presence_compare(gaim_buddy_get_presence((GaimBuddy*)n1), gaim_buddy_get_presence((GaimBuddy*)n2)); break; @@ -1661,6 +1680,77 @@ return ret; } +static int +blist_node_compare_status(GaimBlistNode *n1, GaimBlistNode *n2) +{ + int ret; + + g_return_val_if_fail(n1->type == n2->type, -1); + + switch (n1->type) { + case GAIM_BLIST_CONTACT_NODE: + n1 = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)n1); + n2 = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)n2); + /* now compare the presence of the priority buddies */ + case GAIM_BLIST_BUDDY_NODE: + ret = gaim_presence_compare(gaim_buddy_get_presence((GaimBuddy*)n1), + gaim_buddy_get_presence((GaimBuddy*)n2)); + if (ret != 0) + return ret; + break; + default: + break; + } + + /* Sort alphabetically if presence is not comparable */ + ret = blist_node_compare_text(n1, n2); + + return ret; +} + +static int +get_contact_log_size(GaimBlistNode *c) +{ + int log = 0; + GaimBlistNode *node; + + for (node = c->child; node; node = node->next) { + GaimBuddy *b = (GaimBuddy*)node; + log += gaim_log_get_total_size(GAIM_LOG_IM, b->name, b->account); + } + + return log; +} + +static int +blist_node_compare_log(GaimBlistNode *n1, GaimBlistNode *n2) +{ + int ret; + GaimBuddy *b1, *b2; + + g_return_val_if_fail(n1->type == n2->type, -1); + + switch (n1->type) { + case GAIM_BLIST_BUDDY_NODE: + b1 = (GaimBuddy*)n1; + b2 = (GaimBuddy*)n2; + ret = gaim_log_get_total_size(GAIM_LOG_IM, b2->name, b2->account) - + gaim_log_get_total_size(GAIM_LOG_IM, b1->name, b1->account); + if (ret != 0) + return ret; + break; + case GAIM_BLIST_CONTACT_NODE: + ret = get_contact_log_size(n2) - get_contact_log_size(n1); + if (ret != 0) + return ret; + break; + default: + break; + } + ret = blist_node_compare_text(n1, n2); + return ret; +} + static gboolean blist_clicked(GntTree *tree, GntMouseEvent event, int x, int y, gpointer ggblist) { @@ -1678,27 +1768,19 @@ action->callback(action); } -static void -reconstruct_accounts_menu() +static GntMenuItem *reconstruct_accounts_menu() { - GntWidget *menu, *sub; - GntMenuItem *item; - GntWindow *window; + GntWidget *sub; + GntMenuItem *acc, *item; GList *iter; if (!ggblist) - return; + return NULL; - window = GNT_WINDOW(ggblist->window); + acc = gnt_menuitem_new(_("Accounts")); - menu = gnt_menu_new(GNT_MENU_TOPLEVEL); - gnt_window_set_menu(window, GNT_MENU(menu)); - - item = gnt_menuitem_new(_("Accounts")); - gnt_menu_add_item(GNT_MENU(menu), item); - sub = gnt_menu_new(GNT_MENU_POPUP); - gnt_menuitem_set_submenu(item, GNT_MENU(sub)); + gnt_menuitem_set_submenu(acc, GNT_MENU(sub)); for (iter = gaim_accounts_get_all_active(); iter; iter = g_list_delete_link(iter, iter)) { @@ -1737,8 +1819,60 @@ } } } + return acc; } +static void show_offline_cb(GntMenuItem *item, gpointer n) +{ + gaim_prefs_set_bool(PREF_ROOT "/showoffline", + !gaim_prefs_get_bool(PREF_ROOT "/showoffline")); +} + +static void sort_blist_change_cb(GntMenuItem *item, gpointer n) +{ + gaim_prefs_set_string(PREF_ROOT "/sort_type", n); +} + +static void +create_menu() +{ + GntWidget *menu, *sub; + GntMenuItem *item; + GntWindow *window; + + if (!ggblist) + return; + + window = GNT_WINDOW(ggblist->window); + menu = gnt_menu_new(GNT_MENU_TOPLEVEL); + gnt_window_set_menu(window, GNT_MENU(menu)); + + item = gnt_menuitem_new(_("Options")); + gnt_menu_add_item(GNT_MENU(menu), item); + + sub = gnt_menu_new(GNT_MENU_POPUP); + gnt_menuitem_set_submenu(item, GNT_MENU(sub)); + + item = gnt_menuitem_new(_("Toggle offline buddies")); + gnt_menu_add_item(GNT_MENU(sub), item); + gnt_menuitem_set_callback(GNT_MENUITEM(item), show_offline_cb, NULL); + + item = gnt_menuitem_new(_("Sort by status")); + gnt_menu_add_item(GNT_MENU(sub), item); + gnt_menuitem_set_callback(GNT_MENUITEM(item), sort_blist_change_cb, "status"); + + item = gnt_menuitem_new(_("Sort alphabetically")); + gnt_menu_add_item(GNT_MENU(sub), item); + gnt_menuitem_set_callback(GNT_MENUITEM(item), sort_blist_change_cb, "text"); + + item = gnt_menuitem_new(_("Sort by log size")); + gnt_menu_add_item(GNT_MENU(sub), item); + gnt_menuitem_set_callback(GNT_MENUITEM(item), sort_blist_change_cb, "log"); + + item = reconstruct_accounts_menu(); + gnt_menu_add_item(GNT_MENU(menu), item); +} + void gg_blist_show() { if (ggblist) @@ -1755,7 +1889,7 @@ gnt_box_set_pad(GNT_BOX(ggblist->window), 0); ggblist->tree = gnt_tree_new(); - gnt_tree_set_compare_func(GNT_TREE(ggblist->tree), (GCompareFunc)blist_node_compare); + GNT_WIDGET_SET_FLAGS(ggblist->tree, GNT_WIDGET_NO_BORDER); gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, 25); gnt_widget_set_size(ggblist->tree, gaim_prefs_get_int(PREF_ROOT "/size/width"), @@ -1773,9 +1907,9 @@ gnt_widget_show(ggblist->window); gaim_signal_connect(gaim_connections_get_handle(), "signed-on", gg_blist_get_handle(), - GAIM_CALLBACK(reconstruct_accounts_menu), NULL); + GAIM_CALLBACK(create_menu), NULL); gaim_signal_connect(gaim_connections_get_handle(), "signed-off", gg_blist_get_handle(), - GAIM_CALLBACK(reconstruct_accounts_menu), NULL); + GAIM_CALLBACK(create_menu), NULL); gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(), GAIM_CALLBACK(buddy_status_changed), ggblist); gaim_signal_connect(gaim_blist_get_handle(), "buddy-idle-changed", gg_blist_get_handle(), @@ -1817,7 +1951,7 @@ g_signal_connect(G_OBJECT(ggblist->statustext), "key_pressed", G_CALLBACK(status_text_changed), NULL); - reconstruct_accounts_menu(ggblist); + create_menu(); populate_buddylist(); Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-10-12 02:51:52 UTC (rev 17465) +++ trunk/console/libgnt/gnttree.c 2006-10-12 03:26:33 UTC (rev 17466) @@ -45,6 +45,18 @@ static GntWidgetClass *parent_class = NULL; static guint signals[SIGS] = { 0 }; +/* Move the item at position old to position new */ +static GList * +g_list_reposition_child(GList *list, int old, int new) +{ + gpointer item = g_list_nth_data(list, old); + list = g_list_remove(list, item); + if (old < new) + new--; /* because the positions would have shifted after removing the item */ + list = g_list_insert(list, item, new); + return list; +} + static GntTreeRow * _get_next(GntTreeRow *row, gboolean godeep) { @@ -837,6 +849,75 @@ return NULL; } +void gnt_tree_sort_row(GntTree *tree, gpointer key) +{ + GntTreeRow *row, *q, *s; + int current, newp; + + if (!tree->compare) + return; + + row = g_hash_table_lookup(tree->hash, key); + g_return_if_fail(row != NULL); + + current = g_list_index(tree->list, key); + + if (row->parent) + s = row->parent->child; + else + s = tree->root; + + q = NULL; + while (s) { + if (tree->compare(row->key, s->key) < 0) + break; + q = s; + s = s->next; + } + + /* Move row between q and s */ + if (row == q || row == s) + return; + + if (q == NULL) { + /* row becomes the first child of its parent */ + row->prev->next = row->next; /* row->prev cannot be NULL at this point */ + if (row->next) + row->next->prev = row->prev; + if (row->parent) + row->parent->child = row; + else + tree->root = row; + row->next = s; + s->prev = row; /* s cannot be NULL */ + row->prev = NULL; + newp = g_list_index(tree->list, s) - 1; + } else { + if (row->prev) { + row->prev->next = row->next; + } else { + /* row was the first child of its parent */ + if (row->parent) + row->parent->child = row->next; + else + tree->top = row->next; + } + + if (row->next) + row->next->prev = row->prev; + + q->next = row; + row->prev = q; + if (s) + s->prev = row; + row->next = s; + newp = g_list_index(tree->list, q) + 1; + } + tree->list = g_list_reposition_child(tree->list, current, newp); + + redraw_tree(tree); +} + GntTreeRow *gnt_tree_add_row_after(GntTree *tree, void *key, GntTreeRow *row, void *parent, void *bigbro) { GntTreeRow *pr = NULL; Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-10-12 02:51:52 UTC (rev 17465) +++ trunk/console/libgnt/gnttree.h 2006-10-12 03:26:33 UTC (rev 17466) @@ -123,6 +123,8 @@ void gnt_tree_set_show_separator(GntTree *tree, gboolean set); +void gnt_tree_sort_row(GntTree *tree, void *row); + /* This will try to automatically adjust the width of the columns in the tree */ void gnt_tree_adjust_columns(GntTree *tree); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-10-12 05:29:20
|
Revision: 17469 http://svn.sourceforge.net/gaim/?rev=17469&view=rev Author: sadrul Date: 2006-10-11 22:29:08 -0700 (Wed, 11 Oct 2006) Log Message: ----------- Add a lastlog plugin for gaim-text. Modified Paths: -------------- trunk/console/gntconv.c trunk/console/gntconv.h trunk/console/plugins/Makefile.am Added Paths: ----------- trunk/console/plugins/lastlog.c Modified: trunk/console/gntconv.c =================================================================== --- trunk/console/gntconv.c 2006-10-12 03:33:07 UTC (rev 17468) +++ trunk/console/gntconv.c 2006-10-12 05:29:08 UTC (rev 17469) @@ -46,37 +46,6 @@ #include "config.h" -typedef struct _GGConv GGConv; -typedef struct _GGConvChat GGConvChat; -typedef struct _GGConvIm GGConvIm; - -struct _GGConv -{ - GList *list; - GaimConversation *active_conv; - /*GaimConversation *conv;*/ - - GntWidget *window; /* the container */ - GntWidget *entry; /* entry */ - GntWidget *tv; /* text-view */ - - union - { - GGConvChat *chat; - GGConvIm *im; - } u; -}; - -struct _GGConvChat -{ - GntWidget *userlist; /* the userlist */ -}; - -struct _GGConvIm -{ - void *nothing_for_now; -}; - static gboolean entry_key_pressed(GntWidget *w, const char *key, GGConv *ggconv) { @@ -362,7 +331,7 @@ pos = gnt_text_view_get_lines_below(GNT_TEXT_VIEW(ggconv->tv)); - gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), "\n", GNT_TEXT_FLAG_NORMAL); /* Unnecessary to print the timestamp for delayed message */ if (!(flags & GAIM_MESSAGE_DELAYED) && Modified: trunk/console/gntconv.h =================================================================== --- trunk/console/gntconv.h 2006-10-12 03:33:07 UTC (rev 17468) +++ trunk/console/gntconv.h 2006-10-12 05:29:08 UTC (rev 17469) @@ -25,6 +25,9 @@ #ifndef _GNT_CONV_H #define _GNT_CONV_H +#include <gnt.h> +#include <gntwidget.h> + #include "conversation.h" /*************************************************************************** @@ -32,6 +35,36 @@ ***************************************************************************/ /*@{*/ +typedef struct _GGConv GGConv; +typedef struct _GGConvChat GGConvChat; +typedef struct _GGConvIm GGConvIm; + +struct _GGConv +{ + GList *list; + GaimConversation *active_conv; + + GntWidget *window; /* the container */ + GntWidget *entry; /* entry */ + GntWidget *tv; /* text-view */ + + union + { + GGConvChat *chat; + GGConvIm *im; + } u; +}; + +struct _GGConvChat +{ + GntWidget *userlist; /* the userlist */ +}; + +struct _GGConvIm +{ + void *nothing_for_now; +}; + /** * Get the ui-functions. * Modified: trunk/console/plugins/Makefile.am =================================================================== --- trunk/console/plugins/Makefile.am 2006-10-12 03:33:07 UTC (rev 17468) +++ trunk/console/plugins/Makefile.am 2006-10-12 05:29:08 UTC (rev 17469) @@ -1,19 +1,23 @@ gntgf_la_LDFLAGS = -module -avoid-version gnthistory_la_LDFLAGS = -module -avoid-version +gntlastlog_la_LDFLAGS = -module -avoid-version if PLUGINS plugin_LTLIBRARIES = \ gntgf.la \ - gnthistory.la + gnthistory.la \ + gntlastlog.la plugindir = $(libdir)/gaim gntgf_la_SOURCES = gntgf.c gnthistory_la_SOURCES = gnthistory.c +gntlastlog_la_SOURCES = lastlog.c gntgf_la_LIBADD = $(GLIB_LIBS) $(X11_LIBS) $(top_builddir)/console/libgnt/libgnt.la gnthistory_la_LIBADD = $(GLIB_LIBS) +gntlastlog_la_LIBADD = $(GLIB_LIBS) endif # PLUGINS Added: trunk/console/plugins/lastlog.c =================================================================== --- trunk/console/plugins/lastlog.c (rev 0) +++ trunk/console/plugins/lastlog.c 2006-10-12 05:29:08 UTC (rev 17469) @@ -0,0 +1,142 @@ +/** + * @file lastlog.c Lastlog plugin for gaim-text. + * + * Copyright (C) 2006 Sadrul Habib Chowdhury <sa...@us...> + * + * This program 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; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#define PLUGIN_STATIC_NAME "GntLastlog" + +#include "internal.h" + +#include <plugin.h> +#include <version.h> + +#include <cmds.h> + +#include <gnt.h> +#include <gnttextview.h> +#include <gntwindow.h> + +#include <gntconv.h> +#include <gntplugin.h> + +static GaimCmdId cmd; + +static gboolean +window_kpress_cb(GntWidget *wid, const char *key, GntTextView *view) +{ + if (key[0] == 27) + { + if (strcmp(key+1, GNT_KEY_DOWN) == 0) + gnt_text_view_scroll(view, 1); + else if (strcmp(key+1, GNT_KEY_UP) == 0) + gnt_text_view_scroll(view, -1); + else if (strcmp(key+1, GNT_KEY_PGDOWN) == 0) + gnt_text_view_scroll(view, wid->priv.height - 2); + else if (strcmp(key+1, GNT_KEY_PGUP) == 0) + gnt_text_view_scroll(view, -(wid->priv.height - 2)); + else + return FALSE; + return TRUE; + } + return FALSE; +} + +static GaimCmdRet +lastlog_cb(GaimConversation *conv, const char *cmd, char **args, char **error, gpointer null) +{ + GGConv *ggconv = conv->ui_data; + char **strings = g_strsplit(GNT_TEXT_VIEW(ggconv->tv)->string->str, "\n", 0); + GntWidget *win, *tv; + int i, j; + + win = gnt_window_new(); + gnt_box_set_title(GNT_BOX(win), _("Lastlog")); + + tv = gnt_text_view_new(); + gnt_box_add_widget(GNT_BOX(win), tv); + + gnt_widget_show(win); + + for (i = 0; strings[i]; i++) { + if (strstr(strings[i], args[0]) != NULL) { + char **finds = g_strsplit(strings[i], args[0], 0); + for (j = 0; finds[j]; j++) { + if (j) + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(tv), args[0], GNT_TEXT_FLAG_BOLD); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(tv), finds[j], GNT_TEXT_FLAG_NORMAL); + } + g_strfreev(finds); + gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(tv), "\n", GNT_TEXT_FLAG_NORMAL); + } + } + + g_signal_connect(G_OBJECT(win), "key_pressed", G_CALLBACK(window_kpress_cb), tv); + g_strfreev(strings); + return GAIM_CMD_STATUS_OK; +} + +static gboolean +plugin_load(GaimPlugin *plugin) +{ + cmd = gaim_cmd_register("lastlog", "s", GAIM_CMD_P_DEFAULT, + GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, + lastlog_cb, _("lastlog: Searches for a substring in the backlog."), NULL); + return TRUE; +} + +static gboolean +plugin_unload(GaimPlugin *plugin) +{ + gaim_cmd_unregister(cmd); + return TRUE; +} + +static GaimPluginInfo info = +{ + GAIM_PLUGIN_MAGIC, + GAIM_MAJOR_VERSION, + GAIM_MINOR_VERSION, + GAIM_PLUGIN_STANDARD, + GAIM_GNT_PLUGIN_TYPE, + 0, + NULL, + GAIM_PRIORITY_DEFAULT, + "gntlastlog", + N_("GntLastlog"), + VERSION, + N_("Lastlog plugin for gaim-text."), + N_("Lastlog plugin for gaim-text."), + "Sadrul H Chowdhury <sa...@us...>", + "http://gaim.sourceforge.net", + plugin_load, + plugin_unload, + NULL, + NULL, + NULL, + NULL, + NULL +}; + +static void +init_plugin(GaimPlugin *plugin) +{ +} + +GAIM_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) + Property changes on: trunk/console/plugins/lastlog.c ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sa...@us...> - 2006-10-18 04:00:35
|
Revision: 17512 http://svn.sourceforge.net/gaim/?rev=17512&view=rev Author: sadrul Date: 2006-10-17 21:00:27 -0700 (Tue, 17 Oct 2006) Log Message: ----------- Rocking patch (#1574228) from Richard Nelson (wabz) to fix the behaviour of the status-windows for transient statuses. I butchered it a little, and might have broke something in the process. I take the blames if this causes any problems. Modified Paths: -------------- trunk/console/gntstatus.c trunk/console/libgnt/gnttree.c trunk/console/libgnt/gnttree.h Modified: trunk/console/gntstatus.c =================================================================== --- trunk/console/gntstatus.c 2006-10-18 03:57:50 UTC (rev 17511) +++ trunk/console/gntstatus.c 2006-10-18 04:00:27 UTC (rev 17512) @@ -56,12 +56,19 @@ typedef struct { + GaimAccount *account; + const GaimStatusType *type; + char *message; +} RowInfo; + +typedef struct +{ GntWidget *window; GntWidget *type; GntWidget *message; EditStatus *parent; - GaimAccount *account; + RowInfo *key; } EditSubStatus; static GList *edits; /* List of opened edit-status dialogs */ @@ -213,15 +220,38 @@ } static void +free_key(gpointer key, gpointer n) +{ + RowInfo *row = key; + g_free(row->message); + g_free(key); +} + + +static void update_edit_list(GntWidget *widget, EditStatus *edit) { edits = g_list_remove(edits, edit); gaim_notify_close_with_handle(edit); g_hash_table_foreach(edit->hash, (GHFunc)destroy_substatus_win, NULL); + g_list_foreach((GList*)gnt_tree_get_rows(GNT_TREE(edit->tree)), free_key, NULL); g_free(edit); } static void +set_substatuses(EditStatus *edit) +{ + const GList *iter; + for (iter = gnt_tree_get_rows(GNT_TREE(edit->tree)); iter; iter = iter->next) { + RowInfo *key = iter->data; + if (gnt_tree_get_choice(GNT_TREE(edit->tree), key)) { + gaim_savedstatus_set_substatus(edit->saved, key->account, key->type, key->message); + } + } +} + + +static void use_trans_status_cb(GntWidget *button, EditStatus *edit) { const char *message; @@ -234,6 +264,8 @@ saved = gaim_savedstatus_find_transient_by_type_and_message(prim, message); if (saved == NULL) { saved = gaim_savedstatus_new(NULL, prim); + edit->saved = saved; + set_substatuses(edit); } gaim_savedstatus_set_message(saved, message); gaim_savedstatus_activate(saved); @@ -273,6 +305,7 @@ { edit->saved = gaim_savedstatus_new(title, prim); gaim_savedstatus_set_message(edit->saved, message); + set_substatuses(edit); if (statuses.tree) gnt_tree_add_row_last(GNT_TREE(statuses.tree), edit->saved, gnt_tree_create_row(GNT_TREE(statuses.tree), title, @@ -304,33 +337,39 @@ char *name; const char *type = NULL, *message = NULL; GaimSavedStatusSub *sub = NULL; + RowInfo *key; if (!edit || !edit->tree) return; if (edit->saved) sub = gaim_savedstatus_get_substatus(edit->saved, account); - + + key = g_new0(RowInfo, 1); + key->account = account; + if (sub) { - type = gaim_status_type_get_name(gaim_savedstatus_substatus_get_type(sub)); + key->type = gaim_savedstatus_substatus_get_type(sub); + type = gaim_status_type_get_name(key->type); message = gaim_savedstatus_substatus_get_message(sub); + key->message = g_strdup(message); } name = g_strdup_printf("%s (%s)", gaim_account_get_username(account), gaim_account_get_protocol_name(account)); - gnt_tree_add_choice(GNT_TREE(edit->tree), account, + gnt_tree_add_choice(GNT_TREE(edit->tree), key, gnt_tree_create_row(GNT_TREE(edit->tree), name, type, message), NULL, NULL); if (sub) - gnt_tree_set_choice(GNT_TREE(edit->tree), account, TRUE); + gnt_tree_set_choice(GNT_TREE(edit->tree), key, TRUE); g_free(name); } static void substatus_window_destroy_cb(GntWidget *window, EditSubStatus *sub) { - g_hash_table_remove(sub->parent->hash, sub->account); + g_hash_table_remove(sub->parent->hash, sub->key->account); g_free(sub); } @@ -338,19 +377,23 @@ save_substatus_cb(GntWidget *widget, EditSubStatus *sub) { GaimSavedStatus *saved = sub->parent->saved; - GaimAccount *account = sub->account; + RowInfo *row = sub->key; const char *message; GaimStatusType *type; type = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(sub->type)); message = gnt_entry_get_text(GNT_ENTRY(sub->message)); - gaim_savedstatus_set_substatus(saved, account, type, message); + row->type = type; + row->message = g_strdup(message); - gnt_tree_set_choice(GNT_TREE(sub->parent->tree), account, TRUE); - gnt_tree_change_text(GNT_TREE(sub->parent->tree), account, 1, + if (saved) /* Save the substatus if the savedstatus actually exists. */ + gaim_savedstatus_set_substatus(saved, row->account, type, message); + + gnt_tree_set_choice(GNT_TREE(sub->parent->tree), row, TRUE); + gnt_tree_change_text(GNT_TREE(sub->parent->tree), row, 1, gaim_status_type_get_name(type)); - gnt_tree_change_text(GNT_TREE(sub->parent->tree), account, 2, message); + gnt_tree_change_text(GNT_TREE(sub->parent->tree), row, 2, message); gnt_widget_destroy(sub->window); } @@ -365,11 +408,16 @@ GaimSavedStatusSub *substatus = NULL; const GList *iter; char *name; - GaimAccount *account = gnt_tree_get_selection_data(tree); + RowInfo *selected = gnt_tree_get_selection_data(tree); + GaimAccount *account = selected->account; - if (gnt_tree_get_choice(tree, account)) + if (gnt_tree_get_choice(tree, selected)) { /* There was a savedstatus for this account. Now remove it. */ + g_free(selected->message); + selected->type = NULL; + selected->message = NULL; + /* XXX: should we really be saving it right now? */ gaim_savedstatus_unset_substatus(edit->saved, account); gnt_tree_change_text(tree, account, 1, NULL); gnt_tree_change_text(tree, account, 2, NULL); @@ -384,7 +432,7 @@ sub = g_new0(EditSubStatus, 1); sub->parent = edit; - sub->account = account; + sub->key = selected; sub->window = window = gnt_vbox_new(FALSE); gnt_box_set_toplevel(GNT_BOX(window), TRUE); Modified: trunk/console/libgnt/gnttree.c =================================================================== --- trunk/console/libgnt/gnttree.c 2006-10-18 03:57:50 UTC (rev 17511) +++ trunk/console/libgnt/gnttree.c 2006-10-18 04:00:27 UTC (rev 17512) @@ -795,6 +795,11 @@ return ret; } +const GList *gnt_tree_get_rows(GntTree *tree) +{ + return tree->list; +} + void gnt_tree_scroll(GntTree *tree, int count) { GntTreeRow *row; Modified: trunk/console/libgnt/gnttree.h =================================================================== --- trunk/console/libgnt/gnttree.h 2006-10-18 03:57:50 UTC (rev 17511) +++ trunk/console/libgnt/gnttree.h 2006-10-18 04:00:27 UTC (rev 17512) @@ -88,6 +88,8 @@ GList *gnt_tree_get_selection_text_list(GntTree *tree); +const GList *gnt_tree_get_rows(GntTree *tree); + void gnt_tree_remove(GntTree *tree, gpointer key); void gnt_tree_remove_all(GntTree *tree); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |