├── po ├── POTFILES.in └── Makevars ├── AUTHORS ├── Doxyfile ├── Makefile.am ├── pidgin-window_merge.spec ├── TODO ├── configure.ac ├── BUGS ├── window_merge.h ├── pidgin-window_merge.nsi ├── plugin.h ├── NEWS ├── README.md ├── README ├── utils.c ├── ChangeLog ├── dummy.c ├── plugin.c ├── merge.c └── COPYING /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | plugin.h 2 | window_merge.h 3 | dummy.c 4 | merge.c 5 | plugin.c 6 | utils.c 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | David Michael 2 | All files included in Window Merge versions 0.1 to 0.3 3 | -------------------------------------------------------------------------------- /Doxyfile: -------------------------------------------------------------------------------- 1 | QUIET=YES 2 | WARNINGS=YES 3 | 4 | DISABLE_INDEX=YES 5 | GENERATE_LATEX=NO 6 | HTML_TIMESTAMP=NO 7 | SEARCHENGINE=NO 8 | 9 | EXCLUDE=config.h 10 | 11 | JAVADOC_AUTOBRIEF=YES 12 | ENABLE_PREPROCESSING=NO 13 | EXTRACT_ALL=YES 14 | EXTRACT_STATIC=YES 15 | OPTIMIZE_OUTPUT_FOR_C=YES 16 | SOURCE_BROWSER=YES 17 | STRIP_CODE_COMMENTS=NO 18 | -------------------------------------------------------------------------------- /po/Makevars: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 David Michael 2 | # 3 | # This file is part of Window Merge. 4 | # 5 | # Window Merge is free software: you can redistribute it and/or modify it under 6 | # the terms of the GNU General Public License as published by the Free Software 7 | # Foundation, either version 3 of the License, or (at your option) any later 8 | # version. 9 | # 10 | # Window Merge is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 | # details. 14 | # 15 | # You should have received a copy of the GNU General Public License along with 16 | # Window Merge. If not, see . 17 | 18 | subdir = po 19 | top_builddir = .. 20 | 21 | COPYRIGHT_HOLDER = David Michael 22 | DOMAIN = pidgin-$(PACKAGE) 23 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --no-location 24 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 David Michael 2 | # 3 | # This file is part of Window Merge. 4 | # 5 | # Window Merge is free software: you can redistribute it and/or modify it under 6 | # the terms of the GNU General Public License as published by the Free Software 7 | # Foundation, either version 3 of the License, or (at your option) any later 8 | # version. 9 | # 10 | # Window Merge is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 | # details. 14 | # 15 | # You should have received a copy of the GNU General Public License along with 16 | # Window Merge. If not, see . 17 | 18 | ACLOCAL_AMFLAGS = -I m4 19 | EXTRA_DIST = BUGS Doxyfile 20 | #SUBDIRS = po 21 | 22 | plugin_LTLIBRARIES = window_merge.la 23 | 24 | window_merge_la_CFLAGS = $(pidgin_CFLAGS) 25 | window_merge_la_LDFLAGS = -avoid-version -export-dynamic -module -shared \ 26 | $(LT_NO_UNDEFINED) \ 27 | $(pidgin_LIBS) 28 | window_merge_la_SOURCES = dummy.c merge.c plugin.c utils.c \ 29 | plugin.h window_merge.h 30 | -------------------------------------------------------------------------------- /pidgin-window_merge.spec: -------------------------------------------------------------------------------- 1 | Name: pidgin-window_merge 2 | Version: 0.3 3 | Release: 1%{?dist} 4 | Summary: Merges the Buddy List window with a conversation window 5 | 6 | Group: Applications/Internet 7 | License: GPLv3+ 8 | URL: https://github.com/dm0-/window_merge 9 | Source0: https://github.com/downloads/dm0-/window_merge/window_merge-0.3.tar.gz 10 | 11 | BuildRequires: pidgin-devel 12 | Requires: pidgin 13 | 14 | %global pname %(echo -n %{name} | sed s/^pidgin-//) 15 | %global plugindir %(pkg-config --variable=plugindir pidgin) 16 | 17 | %description 18 | Enabling this plugin will allow conversations to be attached to the Buddy List 19 | window. Preferences are available to customize the plugin's panel layout. 20 | 21 | 22 | %prep 23 | %setup -qn %{pname}-%{version} 24 | 25 | %build 26 | %configure 27 | make %{?_smp_mflags} 28 | 29 | %install 30 | make install DESTDIR=%{buildroot} plugindir=%{plugindir} 31 | rm -f %{buildroot}%{plugindir}/%{pname}.la 32 | 33 | 34 | %files 35 | %{plugindir}/%{pname}.so 36 | %doc AUTHORS BUGS ChangeLog COPYING NEWS README TODO 37 | 38 | 39 | %changelog 40 | * Tue Jul 10 2012 David Michael - 0.3-1 41 | - Update to a newer release 42 | 43 | * Mon Mar 26 2012 David Michael - 0.2-1 44 | - Update to a newer release 45 | 46 | * Fri Mar 16 2012 David Michael - 0.1-1 47 | - Initial package 48 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | This file outlines a few ideas to implement or areas with room for improvement 2 | in the plugin. These items are not necessarily problems to be addressed; for 3 | those, see the BUGS file. 4 | 5 | This file was last revised for distribution with version 0.3. 6 | 7 | 8 | In no particular order, the following are a few nice-to-have changes (maybe): 9 | 10 | * Generalize the dummy conversation file so it is as independent of this plugin 11 | as possible. While the dummy makes Pidgin a bit more volatile for intrepid 12 | users, I've found it to be quite handy in using conversation notebooks almost 13 | as if they were geniune GtkWidgets. This has helped in my experimenting with 14 | other plugins that attach conversation areas all over the place. The next 15 | item can be considered a milestone for this one. 16 | 17 | * Switch to GTK signals for handling the dummy conversation instead of using 18 | Pidgin's signals. Pidgin/purple signals just don't cover all of the possible 19 | scenarios thoroughly. The GtkNotebook page add/remove signals are a much 20 | more efficient and rigorous solution. However, there are a handful of new 21 | issues needing to be addressed in the transition. 22 | 23 | * The plugin theoretically supports multiple Buddy Lists (more or less), but 24 | Pidgin itself seems to be lacking in this regard. If Pidgin ever properly 25 | supports multiple Buddy Lists, this plugin should provide an interface to 26 | manage them independently. A submenu on the menu bar seems simple enough. 27 | 28 | * Find ways to properly handle code labeled with "XXX" comments. They are bits 29 | of code that just seem wrong for some reason or another. Unfortunately, most 30 | of those lines exist to fix crashes that back trace to other subsystems or 31 | plugins. (Granted, they are being caused by this plugin's unexpected member 32 | values in the first place.) 33 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2012 David Michael 2 | # 3 | # This file is part of Window Merge. 4 | # 5 | # Window Merge is free software: you can redistribute it and/or modify it under 6 | # the terms of the GNU General Public License as published by the Free Software 7 | # Foundation, either version 3 of the License, or (at your option) any later 8 | # version. 9 | # 10 | # Window Merge is distributed in the hope that it will be useful, but WITHOUT 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 | # details. 14 | # 15 | # You should have received a copy of the GNU General Public License along with 16 | # Window Merge. If not, see . 17 | 18 | AC_INIT([Window Merge],[0.3], 19 | [fedora.dm0@gmail.com],[window_merge], 20 | [https://github.com/dm0-/window_merge]) 21 | AM_INIT_AUTOMAKE([dist-xz]) 22 | LT_INIT([disable-static win32-dll]) 23 | 24 | AC_CONFIG_FILES([Makefile])# po/Makefile.in]) 25 | AC_CONFIG_HEADERS([config.h]) 26 | AC_CONFIG_MACRO_DIR([m4]) 27 | 28 | #AM_GNU_GETTEXT([external]) 29 | #AM_GNU_GETTEXT_VERSION([0.18]) 30 | 31 | AS_CASE(["$host_os"], 32 | [*mingw*],[AS_VAR_SET([LT_NO_UNDEFINED],[-no-undefined])], 33 | [AS_VAR_SET([LT_NO_UNDEFINED])]) 34 | AC_SUBST([LT_NO_UNDEFINED]) 35 | 36 | PKG_CHECK_EXISTS([gobject-2.0 >= 2.30],, 37 | [AC_DEFINE([G_VALUE_INIT],[{ 0, { { 0 } } }], 38 | [Compatibility for old systems missing this definition in gvalue.h])]) 39 | 40 | PKG_CHECK_MODULES([pidgin],[pidgin],, 41 | [AC_MSG_WARN([[relying on environment pidgin_CFLAGS and pidgin_LIBS]])]) 42 | 43 | m4_ifndef([PKG_CHECK_VAR],[m4_define([PKG_CHECK_VAR],[$5])]) 44 | PKG_CHECK_VAR([pidgin_plugindir],[pidgin],[plugindir],, 45 | [AS_VAR_SET([pidgin_plugindir],['${libdir}/pidgin'])]) 46 | AC_SUBST([plugindir],[$pidgin_plugindir]) 47 | 48 | AC_OUTPUT 49 | -------------------------------------------------------------------------------- /BUGS: -------------------------------------------------------------------------------- 1 | To report bugs that you have found, your best bet is to submit the relevant 2 | information through the site from which you downloaded this package (e.g., 3 | open a Git Hub issue). You can also directly e-mail the address that is dotted 4 | around the project's copyright statements, . Please read 5 | the following issues before reporting to ensure your bug is not already known. 6 | 7 | The issues outlined below are all the problems I have encountered in my own 8 | extremely limited testing of this plugin. This file also serves as a to-do 9 | list for myself with some methods to consider for fixing the problems. 10 | 11 | This file was last revised for distribution with version 0.3. 12 | 13 | 14 | The following is the list of known issues with the plugin, sorted approximately 15 | from most troublesome to least. 16 | 17 | * There are a few ways to cause Pidgin to segfault from messing with the dummy 18 | conversation's tab (dragging it into itself, etc.). This is mostly because 19 | the conversation UI doesn't have an active_conv, which some functions use. 20 | 21 | - Trying to fake the active_conv would cause all sorts of other troubles that 22 | are circumvented by setting it to NULL. 23 | 24 | - Intercepting any GTK events interacting with the dummy tab is a possible 25 | solution, but it will require a slew of callbacks to cancel user actions. 26 | 27 | I imagine most users will have the tab positions at the top which will hide 28 | them automatically when there is only one conversation, avoiding this issue. 29 | 30 | + Pidgin ticket #15062 has a patch to allow safely reordering the dummy tab. 31 | 32 | * Several cursor movement key bindings were disabled on HTML fields. This was 33 | done in order to enable tab switching and message retrieval, since the Buddy 34 | List window has an event handler that stops events which have a binding 35 | defined on a focused HTML widget. 36 | 37 | - An alternative to skipping bindings would be to completely remove the Buddy 38 | List event handler, but that would cause other issues. (Control+B for bold 39 | text input would instead activate the "Add Buddy" dialogue, for example.) 40 | 41 | - The related functions in Pidgin are all static, so I can't call them from a 42 | wrapper function. The code in question could be duplicated, but I am very 43 | much against plugins duplicating any part of the main project's code. 44 | 45 | * The buddy icon in the status box is positioned from the left of the window, 46 | based on the Buddy List's width. This causes it to be drawn over the pane of 47 | conversations when using the "left" position preference. 48 | 49 | + Pidgin ticket #15046 has a patch to correct this. 50 | -------------------------------------------------------------------------------- /window_merge.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file window_merge.h 3 | * Defines all the prototypes of functions shared across plugin source files 4 | * 5 | * @section LICENSE 6 | * Copyright (C) 2012 David Michael 7 | * 8 | * This file is part of Window Merge. 9 | * 10 | * Window Merge is free software: you can redistribute it and/or modify it 11 | * under the terms of the GNU General Public License as published by the Free 12 | * Software Foundation, either version 3 of the License, or (at your option) 13 | * any later version. 14 | * 15 | * Window Merge is distributed in the hope that it will be useful, but WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 18 | * more details. 19 | * 20 | * You should have received a copy of the GNU General Public License along with 21 | * Window Merge. If not, see . 22 | **/ 23 | 24 | #ifndef __WINDOW_MERGE_H__ 25 | #define __WINDOW_MERGE_H__ 26 | 27 | /* Functions for Merged Windows */ 28 | void pwm_merge_conversation(PidginBuddyList *); 29 | void pwm_split_conversation(PidginBuddyList *); 30 | void pwm_create_paned_layout(PidginBuddyList *, const char *); 31 | void pwm_set_conv_menus_visible(PidginBuddyList *, gboolean); 32 | 33 | /* Dummy Conversation Functions */ 34 | void pwm_init_dummy_conversation(PidginBuddyList *); 35 | void pwm_show_dummy_conversation(PidginBuddyList *); 36 | void pwm_hide_dummy_conversation(PidginBuddyList *); 37 | void pwm_free_dummy_conversation(PidginBuddyList *); 38 | 39 | /* Utility Functions */ 40 | PidginWindow *pwm_blist_get_convs(PidginBuddyList *); 41 | PidginBuddyList *pwm_convs_get_blist(PidginWindow *); 42 | void pwm_widget_replace(GtkWidget *, GtkWidget *, GtkWidget *); 43 | 44 | #define pwm_store(pidgin_window, name, value) \ 45 | g_object_set_data(G_OBJECT((pidgin_window)->window), "pwm_" name, value) 46 | 47 | #define pwm_fetch(pidgin_window, name) \ 48 | g_object_get_data(G_OBJECT((pidgin_window)->window), "pwm_" name) 49 | 50 | #define pwm_clear(pidgin_window, name) \ 51 | g_object_steal_data(G_OBJECT((pidgin_window)->window), "pwm_" name) 52 | 53 | /* TRANSLATORS: This is the user-visible name of the plugin. The name was 54 | intended to give a brief sense of what the plugin does, so feel free to be 55 | liberal in adjusting it to make sense for a given locale. */ 56 | #define PWM_STR_NAME N_("Window Merge") 57 | 58 | /* TRANSLATORS: This is the name of the conversation placement option that is 59 | added to the list to attach conversations to the Buddy List by default. */ 60 | #define PWM_STR_CP_BLIST N_("Buddy List window") 61 | 62 | #endif /* ifndef __WINDOW_MERGE_H__ */ 63 | -------------------------------------------------------------------------------- /pidgin-window_merge.nsi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/makensis 2 | # Use this in the source directory after the "make" command ends successfully. 3 | 4 | !define name "Window Merge" 5 | !define version 0.3 6 | !define url "https://github.com/dm0-/window_merge" 7 | !define rk 'HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${name}"' 8 | 9 | Name "${name} ${version}" 10 | OutFile "Install ${name} ${version}.exe" 11 | 12 | RequestExecutionLevel admin 13 | SetCompressor /solid lzma 14 | XPStyle on 15 | 16 | # Page configuration 17 | 18 | Page license 19 | LicenseData COPYING 20 | LicenseText \ 21 | "This is not an EULA. It is a free software distribution license. The \ 22 | source code is available at <${url}>." \ 23 | "Continue" 24 | 25 | Page directory 26 | DirText \ 27 | "Please select the Pidgin installation folder. This folder must contain \ 28 | the file pidgin.exe to proceed." \ 29 | "Pidgin Installation Folder" 30 | InstallDir $ProgramFiles\Pidgin 31 | InstallDirRegKey HKLM SOFTWARE\pidgin "" 32 | 33 | Page instfiles 34 | ShowInstDetails show 35 | 36 | UninstPage uninstConfirm 37 | 38 | UninstPage instfiles 39 | ShowUninstDetails show 40 | 41 | # Callback functions 42 | 43 | Function .onVerifyInstDir 44 | IfFileExists $INSTDIR\pidgin.exe good 45 | Abort 46 | good: 47 | FunctionEnd 48 | 49 | # Installation sections 50 | 51 | Var install_size 52 | 53 | Section "${name}" section_index_pwm 54 | SectionIn RO 55 | SetOutPath $INSTDIR\plugins 56 | File .libs/window_merge.dll 57 | 58 | SectionGetSize ${section_index_pwm} $0 59 | IntOp $install_size $install_size + $0 60 | SectionEnd 61 | 62 | Section -post section_index_post 63 | WriteUninstaller "$INSTDIR\Uninstall ${name}.exe" 64 | 65 | SectionGetSize ${section_index_post} $0 66 | IntOp $install_size $install_size + $0 67 | IntFmt $install_size 0x%08X $install_size 68 | 69 | WriteRegStr ${rk} DisplayName "Pidgin - ${name}" 70 | WriteRegStr ${rk} DisplayVersion "${version}" 71 | WriteRegStr ${rk} DisplayIcon '"$INSTDIR\pidgin.exe"' 72 | WriteRegStr ${rk} UninstallString '"$INSTDIR\Uninstall ${name}.exe"' 73 | WriteRegStr ${rk} QuietUninstallString '"$INSTDIR\Uninstall ${name}.exe" /S' 74 | WriteRegStr ${rk} URLInfoAbout "${url}" 75 | WriteRegStr ${rk} URLUpdateInfo "${url}/downloads" 76 | WriteRegStr ${rk} HelpLink "${url}/wiki" 77 | WriteRegDWORD ${rk} EstimatedSize $install_size 78 | WriteRegDWORD ${rk} NoModify 0x00000001 79 | WriteRegDWORD ${rk} NoRepair 0x00000001 80 | SectionEnd 81 | 82 | # Uninstallation sections 83 | 84 | Section Uninstall 85 | Delete /rebootok $INSTDIR\plugins\window_merge.dll 86 | Delete /rebootok "$INSTDIR\Uninstall ${name}.exe" 87 | 88 | DeleteRegKey ${rk} 89 | SectionEnd 90 | -------------------------------------------------------------------------------- /plugin.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file plugin.h 3 | * Prepares definitions to abstract project information passed from configure 4 | * 5 | * It also sets up definitions required by other headers for translations and 6 | * building Pidgin plugins properly. This header should therefore be included 7 | * in source files before any system headers. 8 | * 9 | * @section LICENSE 10 | * Copyright (C) 2012 David Michael 11 | * 12 | * This file is part of Window Merge. 13 | * 14 | * Window Merge is free software: you can redistribute it and/or modify it 15 | * under the terms of the GNU General Public License as published by the Free 16 | * Software Foundation, either version 3 of the License, or (at your option) 17 | * any later version. 18 | * 19 | * Window Merge is distributed in the hope that it will be useful, but WITHOUT 20 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 22 | * more details. 23 | * 24 | * You should have received a copy of the GNU General Public License along with 25 | * Window Merge. If not, see . 26 | **/ 27 | 28 | #ifndef __PLUGIN_H__ 29 | #define __PLUGIN_H__ 30 | 31 | #ifdef __G_LIB_H__ 32 | #error "The file plugin.h must be included first to properly build the plugin." 33 | #endif 34 | 35 | #ifdef HAVE_CONFIG_H 36 | #include "config.h" 37 | #endif 38 | 39 | #define PLUGIN_AUTHOR "dm0" 40 | #define PLUGIN_ID PLUGIN_TYPE "-" PLUGIN_AUTHOR "-" PLUGIN_TOKEN 41 | #define PLUGIN_NAME PWM_STR_NAME 42 | #define PLUGIN_TOKEN PACKAGE_TARNAME 43 | #define PLUGIN_TYPE "gtk" 44 | #define PLUGIN_URL PACKAGE_URL 45 | #define PLUGIN_VERSION PACKAGE_VERSION 46 | 47 | #define PREF_ROOT "/plugins/" PLUGIN_TYPE "/" PLUGIN_TOKEN 48 | #define PREF_HEIGHT PREF_ROOT "/blist_height" 49 | #define PREF_WIDTH PREF_ROOT "/blist_width" 50 | #define PREF_SIDE PREF_ROOT "/convs_side" 51 | 52 | /* Tell the libpurple headers to build this correctly. */ 53 | #define PURPLE_PLUGINS 54 | 55 | /* Set up a convenient flag for strict compiling with unused callback parms. */ 56 | #ifdef __GNUC__ 57 | #define U __attribute__((unused)) 58 | #else 59 | #define U /* unused */ 60 | #endif 61 | 62 | /* Check Pidgin's localedir if a path was not explicitly specified. */ 63 | #ifndef LOCALEDIR 64 | #define LOCALEDIR bindtextdomain("pidgin", NULL) 65 | #endif 66 | 67 | /* Define the translation domain to appear as a subpackage of Pidgin. */ 68 | #define GETTEXT_PACKAGE "pidgin-" PLUGIN_TOKEN 69 | 70 | /* Determine whether to enable translations based on configure options. */ 71 | #ifdef ENABLE_NLS 72 | #include 73 | #else 74 | #define _(s) (s) 75 | #define N_(s) (s) 76 | #endif 77 | 78 | #endif /* ifndef __PLUGIN_H__ */ 79 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | This file outlines broad user interface changes. For a list of more specific 2 | code modifications, see the ChangeLog file. For newly discovered problems with 3 | the software, see the BUGS file. 4 | 5 | 6 | * Updated Distribution of Window Merge 0.3 7 | 8 | ** Plugin preferences 9 | 10 | *** If the conversation placement preference was set to "Buddy List window" and 11 | the plugin was then disabled, it will use the "Last created window" option. 12 | 13 | ** Buddy List window 14 | 15 | *** When the plugin is disabled, the Buddy List and conversation panes are now 16 | split into two independent windows (instead of closing and replacing). 17 | 18 | *** A label and icon have been added to the placeholder tab. 19 | 20 | *** The Buddy List pane should now remain at a fixed size when resizing the 21 | window, even when it is the right or bottom pane. I.e. the conversation 22 | pane should always be resized with the window. 23 | 24 | *** The notification icon in the menu bar has been reordered to remain right- 25 | justified. This also makes the conversation menu items appear adjacent to 26 | the Buddy List items. 27 | 28 | *** Message notifications are now cleared when the Buddy List is focused. 29 | 30 | 31 | * Updated Distribution of Window Merge 0.2 32 | 33 | ** Buddy List window 34 | 35 | *** The window icon list will be unset when conversations are closed or the 36 | plugin is disabled. This will cause the window to display the default icon 37 | of the application, which is what the Buddy List normally displays. 38 | 39 | *** Several conversation keyboard events are now properly handled, including 40 | message retrieval and menu accelerators. 41 | 42 | *** When disabling the plugin, conversations open in the Buddy List window will 43 | be run through conversation placement so they are not lost. 44 | 45 | 46 | * Initial Distribution of Window Merge 0.1 47 | 48 | ** Plugin preferences 49 | 50 | *** A preference frame interface is provided for choosing on which side of the 51 | Buddy List window to attach conversations. 52 | 53 | *** The height and width (depending on orientation from the above preference) 54 | of the Buddy List pane are stored as preferences when changed by the user. 55 | 56 | *** A new conversation placement preference option is added, allowing all new 57 | conversations to be attached to the default Buddy List window. 58 | 59 | ** Buddy List window 60 | 61 | *** The notebook in main_vbox is replaced by resizable panes containing the 62 | Buddy List notebook and a conversation window notebook. 63 | 64 | *** An instructions page is displayed in the Buddy List window's conversation 65 | notebook when no conversations are open. The tab can be used as a normal 66 | conversation's infopane; i.e., conversations from other windows can be 67 | dragged onto it to attach them to the window. 68 | 69 | *** The Buddy List window title will be set to the name of the active 70 | conversation in its notebook, as is done with conversation windows. 71 | 72 | *** Items from a conversation window menu bar are appended to the Buddy List 73 | menu bar. Their visibility is determined by the presence of active 74 | conversations in the Buddy List window's conversation notebook. 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Window Merge 2 | 3 | This file contains instructions related to GitHub written in markdown format. 4 | For basic information about the project in plain text, see the _README_ file. 5 | Also check the [project wiki page](http://github.com/dm0-/window_merge/wiki) 6 | for step-by-step instructions regarding more complex build scenarios. 7 | 8 | ## About the Project 9 | 10 | Window Merge is a [Pidgin](http://pidgin.im/) plugin that merges a conversation 11 | window with the Buddy List window. It can be used to achieve a rudimentary 12 | "single window mode" for Pidgin. Both Window Merge and Pidgin itself should be 13 | kept updated for the most stable experience. 14 | 15 | This project was not written and is not maintained by Pidgin developers. The 16 | nature of this project can potentially destabilize Pidgin or its other plugins, 17 | so use it at your own risk. 18 | 19 | ## Preparing the Source 20 | 21 | The source files available at the GitHub repository are intended for project 22 | maintainers, not necessarily distributors or end users. The [project downloads 23 | page](http://github.com/dm0-/window_merge/downloads) offers some distribution 24 | tarballs suitable for compiling and prebuilt binaries for Microsoft Windows. 25 | 26 | The GitHub repository contains all the configuration files necessary to compile 27 | or create distribution archives with the latest commits. This will require the 28 | following tools to be installed and available on your system: 29 | 30 | * [git](http://git-scm.com/) 31 | * [autoconf](http://www.gnu.org/software/autoconf/) 32 | * [automake](http://www.gnu.org/software/automake/) 33 | * [libtool](http://www.gnu.org/software/libtool/) 34 | * [gettext](http://www.gnu.org/software/gettext/) 35 | 36 | On a command line of any given operating system, running the following should 37 | create a copy of the project's git repository and change to its directory. 38 | 39 | git clone https://github.com/dm0-/window_merge.git 40 | cd window_merge 41 | 42 | Now the build system scripts will be generated, and boilerplate project files 43 | will be copied into the source tree. 44 | 45 | mkdir m4 46 | autoreconf -fi 47 | 48 | At this point, the source in the current directory is ready to be compiled. To 49 | create and verify a distribution archive, run the following commands. 50 | 51 | ./configure 52 | make distcheck 53 | 54 | ## System Packaging 55 | 56 | The GitHub repository provides two system-specific packaging scripts that are 57 | not included in the distribution archives. (Remember to check the [project 58 | wiki](http://github.com/dm0-/window_merge/wiki) for step-by-step instructions 59 | on how to use them.) 60 | 61 | ### RPM (GNU/Linux) 62 | 63 | The file _pidgin-window_merge.spec_ can be used with a source archive, as would 64 | have been created with _make distcheck_, to produce an RPM package. The spec 65 | may use conventions that require a relatively recent version of RPM, but it 66 | should work without much hassle on any GNU/Linux distribution conforming to 67 | sensible packaging standards. 68 | 69 | ### NSIS (Microsoft Windows) 70 | 71 | The build system should be able to determine when it was configured to use the 72 | MinGW compiler, and it should write a Windows DLL file as a result. When built 73 | in this manner (i.e. after _make_ successfully ends), the included script 74 | _pidgin-window_merge.nsi_ can be run to create an executable installer. The 75 | required _makensis_ command is a part of [NSIS](http://nsis.sourceforge.net/). 76 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | The Window Merge plugin for Pidgin is briefly documented in this file. You can 2 | search for the following strings to jump to the corresponding section pages. 3 | 4 | PLUGIN OVERVIEW 5 | DOCUMENTATION / PROJECT HISTORY 6 | SIMPLE BUILD INSTRUCTIONS 7 | 8 | This plugin is named "Window Merge", with a project name "window_merge". Even 9 | though package names such as "pidgin-window_merge" may be used, this plugin was 10 | not written and is not maintained by Pidgin developers. The plugin should be 11 | considered unsupported and unstable for the time being. 12 | 13 | This file was last revised for distribution with version 0.3. 14 | 15 | 16 | PLUGIN OVERVIEW 17 | 18 | A Pidgin conversation window is merged into the Buddy List window. Both the 19 | conversation notebook and Buddy List notebook are presented in resizable panes. 20 | Items from the conversation window menu bar are also migrated to the Buddy List 21 | menu bar, but are only visible when conversations are open in the Buddy List. 22 | 23 | Users can customize where the conversations are attached relative to the Buddy 24 | List in the plugin's preferences frame. The position of the panes' slider is 25 | also saved as a user preference. In addition, an option is added to the 26 | conversation placement preference that allows new conversations to be opened in 27 | the Buddy List by default. 28 | 29 | Please note that this plugin works by altering internal Pidgin data structures 30 | in ways that were not intended by the Pidgin developers. For this reason, this 31 | plugin should not be enabled in situations where receiving instant messages is 32 | critical. 33 | 34 | 35 | DOCUMENTATION / PROJECT HISTORY 36 | 37 | The following is the list of documentation files with their specific content: 38 | 39 | AUTHORS 40 | A list of copyright holders in the project and their contributions 41 | BUGS 42 | A list of known problems with the current plugin distribution 43 | ChangeLog 44 | A list of code changes in specific files and functions 45 | COPYING 46 | A copy of the license that covers this software 47 | INSTALL 48 | A copy of the generic installation instructions for GNU software 49 | NEWS 50 | A list of user-visible changes to the plugin 51 | README 52 | A document of general information about the project 53 | TODO 54 | A list of planned or potential changes for future versions 55 | 56 | A sample doxygen configuration file "Doxyfile" is provided to produce an HTML- 57 | formatted code overview. It can be customized to preference, or used as is by 58 | simply running the command "doxygen" in the source directory. 59 | 60 | 61 | SIMPLE BUILD INSTRUCTIONS 62 | 63 | If the Pidgin development files are properly installed (prebuilt packages are 64 | probably named "pidgin-devel" or "pidgin-dev"), only two commands should be 65 | necessary to build the plugin (run from this file's source directory): 66 | 67 | ./configure 68 | make 69 | 70 | If successful, the plugin should have been built at ".libs/window_merge.so". 71 | This command will install the plugin for your own account: 72 | 73 | make install plugindir=~/.purple/plugins 74 | 75 | Alternatively, run the following as root to install the plugin for all users: 76 | 77 | make install 78 | 79 | More information about build commands can be found in the INSTALL file. 80 | 81 | Note that if configure specified to compile the project for Microsoft Windows 82 | with MinGW, the output file would be ".libs/window_merge.dll". 83 | 84 | This file can be placed in the folder "%AppData%\.purple\plugins" to install it 85 | for your own account. (Create the "plugins" folder if it doesn't exist; enter 86 | "%AppData%\.purple" directly into the Explorer address bar to find it.) 87 | 88 | To install it for all users, place "window_merge.dll" in the "plugins" folder 89 | found at Pidgin's installation location. 90 | -------------------------------------------------------------------------------- /utils.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file utils.c 3 | * Provides a few miscellaneous routines that make life easier 4 | * 5 | * @section LICENSE 6 | * Copyright (C) 2012 David Michael 7 | * 8 | * This file is part of Window Merge. 9 | * 10 | * Window Merge is free software: you can redistribute it and/or modify it 11 | * under the terms of the GNU General Public License as published by the Free 12 | * Software Foundation, either version 3 of the License, or (at your option) 13 | * any later version. 14 | * 15 | * Window Merge is distributed in the hope that it will be useful, but WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 18 | * more details. 19 | * 20 | * You should have received a copy of the GNU General Public License along with 21 | * Window Merge. If not, see . 22 | **/ 23 | 24 | #include "plugin.h" 25 | #include 26 | #include 27 | 28 | 29 | /** 30 | * Return the conversation window structure merged into the given Buddy List 31 | * 32 | * @param[in] gtkblist The Buddy List whose conversation window is requested 33 | * @return The conversation window structure tied to gtkblist 34 | **/ 35 | PidginWindow * 36 | pwm_blist_get_convs(PidginBuddyList *gtkblist) 37 | { 38 | if ( gtkblist == NULL ) 39 | return NULL; 40 | 41 | return g_object_get_data(G_OBJECT(gtkblist->notebook), "pwm_convs"); 42 | } 43 | 44 | 45 | /** 46 | * Return the Buddy List structure merged into the given conversation window 47 | * 48 | * @param[in] gtkconvwin The conversation window whose Buddy List is requested 49 | * @return The Buddy List structure tied to gtkconvwin 50 | **/ 51 | PidginBuddyList * 52 | pwm_convs_get_blist(PidginWindow *gtkconvwin) 53 | { 54 | if ( gtkconvwin == NULL ) 55 | return NULL; 56 | 57 | return g_object_get_data(G_OBJECT(gtkconvwin->notebook), "pwm_blist"); 58 | } 59 | 60 | 61 | /** 62 | * Given a parented widget, replace it and reparent it into a new container 63 | * 64 | * @param[in] child The widget to be replaced and reparented 65 | * @param[in] swap The widget that will be the replacement 66 | * @param[in] new_parent The container to adopt the displaced child widget 67 | * 68 | * @note This only supports existing parent widgets of type GtkPaned or GtkBox. 69 | **/ 70 | void 71 | pwm_widget_replace(GtkWidget *child, GtkWidget *swap, GtkWidget *new_parent) 72 | { 73 | GtkWidget *parent; /*< The parent of the widget to be replaced */ 74 | GValue val1 = G_VALUE_INIT; /*< GtkContainer child property (manual get) */ 75 | GValue val2 = G_VALUE_INIT; /*< GtkContainer child property (manual get) */ 76 | GtkPackType pack_type; /*< GtkBox child property "pack-type" */ 77 | guint padding; /*< GtkBox child property "padding" */ 78 | gboolean expand; /*< GtkBox child property "expand" */ 79 | gboolean fill; /*< GtkBox child property "fill" */ 80 | gboolean is_pane1 = FALSE; /*< Whether the child is the first pane */ 81 | gboolean should_unparent; /*< Whether the replacement is parented */ 82 | 83 | /* Sanity check: If not given a child or replacement, we've nothing to do. */ 84 | if ( child == NULL || swap == NULL ) 85 | return; 86 | 87 | parent = gtk_widget_get_parent(child); 88 | should_unparent = GTK_IS_CONTAINER(gtk_widget_get_parent(swap)); 89 | 90 | /* For a GtkPaned parent, retrieve the current child widget properties. */ 91 | if ( GTK_IS_PANED(parent) ) { 92 | g_value_init(&val1, G_TYPE_BOOLEAN); 93 | gtk_container_child_get_property(GTK_CONTAINER(parent), child, 94 | "resize", &val1); 95 | g_value_init(&val2, G_TYPE_BOOLEAN); 96 | gtk_container_child_get_property(GTK_CONTAINER(parent), child, 97 | "shrink", &val2); 98 | is_pane1 = gtk_paned_get_child1(GTK_PANED(parent)) == child; 99 | } 100 | 101 | /* For a GtkBox parent, retrieve the current child widget properties. */ 102 | else if ( GTK_IS_BOX(parent) ) { 103 | g_value_init(&val1, G_TYPE_INT); 104 | gtk_container_child_get_property(GTK_CONTAINER(parent), child, 105 | "position", &val1); 106 | gtk_box_query_child_packing(GTK_BOX(parent), child, 107 | &expand, &fill, &padding, &pack_type); 108 | } 109 | 110 | /* Unparent if the replacement already has a parent container. */ 111 | if ( should_unparent ) { 112 | g_object_ref_sink(G_OBJECT(swap)); 113 | gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(swap)), swap); 114 | } 115 | 116 | /* If no one is willing to adopt the orphaned child, it must be destroyed. */ 117 | if ( new_parent != NULL ) 118 | gtk_widget_reparent(child, new_parent); 119 | else 120 | gtk_widget_destroy(child); 121 | 122 | /* For a GtkPaned parent, add the new widget and restore child properties. */ 123 | if ( GTK_IS_PANED(parent) ) { 124 | if ( is_pane1 ) 125 | gtk_paned_pack1(GTK_PANED(parent), swap, 126 | g_value_get_boolean(&val1), g_value_get_boolean(&val2)); 127 | else 128 | gtk_paned_pack2(GTK_PANED(parent), swap, 129 | g_value_get_boolean(&val1), g_value_get_boolean(&val2)); 130 | } 131 | 132 | /* For a GtkBox parent, add the new widget and restore child properties. */ 133 | else if ( GTK_IS_BOX(parent) ) { 134 | if ( pack_type == GTK_PACK_START ) 135 | gtk_box_pack_start(GTK_BOX(parent), swap, expand, fill, padding); 136 | else 137 | gtk_box_pack_end(GTK_BOX(parent), swap, expand, fill, padding); 138 | gtk_box_reorder_child(GTK_BOX(parent), swap, g_value_get_int(&val1)); 139 | } 140 | 141 | /* Remove the replacement's temporary reference that avoided destruction. */ 142 | if ( should_unparent ) 143 | g_object_unref(G_OBJECT(swap)); 144 | } 145 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2012-07-10 David Michael 2 | 3 | Updated project distribution, version 0.3 4 | 5 | 2012-07-06 David Michael 6 | 7 | * merge.c (pwm_split_conversation): Conditionally display the window. 8 | 9 | * merge.c (pwm_merge_conversation): Simplify registering accelerators. 10 | (pwm_split_conversation): Simplify unregistering accelerators. 11 | 12 | 2012-05-31 David Michael 13 | 14 | * utils.c (pwm_widget_replace): Initialize a boolean to stop a warning. 15 | 16 | 2012-05-30 David Michael 17 | 18 | * merge.c (focus_in_event_cb): Add this handler to synthesize events. 19 | (pwm_merge_conversation): Start simulating focus to the hidden window. 20 | (pwm_split_conversation): Stop simulating focus to the hidden window. 21 | 22 | * merge.c: pwm_destroy_conversation -> pwm_split_conversation 23 | (pwm_merge_conversation): Store the conversations' GtkWindow for later. 24 | (pwm_split_conversation): Restore the window instead of destroying it. 25 | (pwm_create_paned_layout): Create a placeholder for the conversations. 26 | * plugin.c (plugin_unload): Use the new function name. 27 | * window_merge.h: Update the function's prototype. 28 | 29 | * utils.c (pwm_widget_replace): Add a widget replacement function. 30 | * window_merge.h: Define its prototype. 31 | * merge.c (pwm_destroy_conversation): Replace (not reparent) notebooks. 32 | (pwm_create_paned_layout): Use replacement for constructing the panes. 33 | 34 | * dummy.c (pwm_free_dummy_conversation): Remove the dummy tab first. 35 | 36 | * utils.c (pwm_store, pwm_fetch, pwm_clear, pwm_free, pwm_destroy): 37 | Remove these function definitions entirely. 38 | * window_merge.h: Remove the above functions' prototypes. 39 | (pwm_store, pwm_fetch, pwm_clear): Define new convenience macros. 40 | * merge.c: Remove prefixes from pointer names, and handle freeing. 41 | * plugin.c: Likewise. 42 | * dummy.c: Likewise. 43 | 44 | 2012-05-29 David Michael 45 | 46 | * dummy.c: pwm_new_dummy_conversation -> pwm_init_dummy_conversation 47 | (pwm_init_dummy_conversation): Hide the dummy struct from callers. 48 | * merge.c (pwm_merge_conversation): Use the new function name and type. 49 | * window_merge.h: Update the function's prototype. 50 | 51 | * plugin.c (conv_placement_by_blist): Try "last" placement if disabled. 52 | 53 | 2012-05-08 David Michael 54 | 55 | * merge.c (pwm_merge_conversation): Use menutray's parent for menu bar. 56 | 57 | 2012-05-07 David Michael 58 | 59 | * merge.c (notify_position_cb, notify_max_position_cb): 60 | Use the signal data pointers instead of g_object_get_data. 61 | (notify_max_position_cb, pwm_create_paned_layout): 62 | Switch to g_object_connect and set the signal data pointers. 63 | (pwm_create_paned_layout): Remove g_object_set_data on the panes. 64 | 65 | * merge.c (notify_position_cb, notify_max_position_cb): 66 | Determine slider position based on Buddy List size instead of convs. 67 | 68 | * window_merge.h: Add global definitions for user-visible strings. 69 | * plugin.h: Remove global definitions for user-visible strings. 70 | 71 | 2012-04-29 David Michael 72 | 73 | * dummy.c (pwm_new_dummy_conversation): Zero-fill the dummy's struct. 74 | 75 | 2012-04-19 David Michael 76 | 77 | * plugin.c (plugin_init) [ENABLE_NLS]: Initialize the text domain. 78 | 79 | * plugin.h: Add TRANSLATORS comments for documenting the POT file. 80 | * plugin.c: Likewise. 81 | * dummy.c: Likewise. 82 | 83 | * plugin.h: Remove most strings' configure-dependence for xgettext. 84 | * plugin.c (info): Adjust the struct to mark strings for translation. 85 | (plugin_init): Translate plugin property strings. 86 | (plugin_load): Use the prefixed preference name string. 87 | (get_plugin_pref_frame): Refactor strings to allow translator comments. 88 | * dummy.c (pwm_new_dummy_conversation): Switch to a formatted string. 89 | (pwm_show_dummy_conversation): Use the new prefixed name string. 90 | 91 | * plugin.h: Centralize i18n includes and CPP definitions. 92 | * plugin.c: Remove unnecessary i18n include. 93 | * dummy.c: Likewise. 94 | 95 | * plugin.h: Define a separate identifier for each preference. 96 | * plugin.c (plugin_init): Initialize all preferences with new labels. 97 | (plugin_load): Use the new layout pref label for connecting the signal. 98 | (get_plugin_pref_frame): Use the layout label in the preferences frame. 99 | * merge.c (pwm_merge_conversation): Use the new layout pref label. 100 | (notify_position_cb, notify_max_position_cb): Use new size pref labels. 101 | 102 | 2012-04-13 David Michael 103 | 104 | * dummy.c (pwm_show_dummy_conversation): Add a tab label and icon. 105 | 106 | 2012-04-06 David Michael 107 | 108 | * merge.c (pwm_merge_conversation): Reorder the menutray widget. 109 | 110 | 2012-03-28 David Michael 111 | 112 | * merge.c (pwm_create_paned_layout): Set "resize" child properties. 113 | 114 | 2012-03-26 David Michael 115 | 116 | Updated project distribution, version 0.2 117 | 118 | * merge.c (pwm_merge_conversation): Add conversation menu accel_groups. 119 | (pwm_destroy_conversation): Remove the accel_groups when finished. 120 | 121 | 2012-03-24 David Michael 122 | 123 | * merge.c (pwm_destroy_conversation, pwm_set_conv_menus_visible): 124 | Added or rearranged some variables for uniformity in the file. 125 | 126 | * merge.c (pwm_destroy_conversation): Spare conversations on disable. 127 | 128 | 2012-03-23 David Michael 129 | 130 | * merge.c (pwm_merge_conversation): Skip some "move-cursor" bindings. 131 | 132 | 2012-03-22 David Michael 133 | 134 | * merge.c (pwm_destroy_conversation): Unset window icons. 135 | * plugin.c (deleting_conversation_cb): Unset window icons. 136 | 137 | 2012-03-16 David Michael 138 | 139 | Initial project distribution, version 0.1 140 | -------------------------------------------------------------------------------- /dummy.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file dummy.c 3 | * Separates the details of the dummy conversation tab from the fray 4 | * 5 | * The dummy tab is a monstrosity bearing the original intention of simplifying 6 | * an area to which conversations could be dragged and attached. It is only 7 | * supposed to be displayed when no conversations are open in a merged window. 8 | * Pidgin callbacks add and remove it as conversations come and go. 9 | * 10 | * @section LICENSE 11 | * Copyright (C) 2012 David Michael 12 | * 13 | * This file is part of Window Merge. 14 | * 15 | * Window Merge is free software: you can redistribute it and/or modify it 16 | * under the terms of the GNU General Public License as published by the Free 17 | * Software Foundation, either version 3 of the License, or (at your option) 18 | * any later version. 19 | * 20 | * Window Merge is distributed in the hope that it will be useful, but WITHOUT 21 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 23 | * more details. 24 | * 25 | * You should have received a copy of the GNU General Public License along with 26 | * Window Merge. If not, see . 27 | **/ 28 | 29 | #include "plugin.h" 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include "window_merge.h" 36 | 37 | 38 | /** 39 | * Allocate and return a conversation UI that only holds an instructions label 40 | * 41 | * @return Pointer to the allocated conversation UI structure 42 | * 43 | * @note Remember pwm_free_dummy_conversation() for the window that owns this. 44 | **/ 45 | void 46 | pwm_init_dummy_conversation(PidginBuddyList *gtkblist) 47 | { 48 | PidginConversation *gtkconv; /*< The new (pretend) conversation structure */ 49 | gchar *html; /*< The HTML-formatted instructions text */ 50 | gchar *pretty; /*< The HTML text with prettier arrow chars */ 51 | 52 | gtkconv = g_new0(PidginConversation, 1); 53 | 54 | /* Define the label widget to be accepted as a conversation tab. */ 55 | gtkconv->tab_cont = gtk_label_new(NULL); 56 | gtk_label_set_line_wrap(GTK_LABEL(gtkconv->tab_cont), TRUE); 57 | gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_cont), 0.5f, 0.2f); 58 | g_object_set_data(G_OBJECT(gtkconv->tab_cont), 59 | "PidginConversation", gtkconv); 60 | 61 | /* TRANSLATORS: A few notes on this one: 62 | 1) Try to keep the "->" styled arrows to denote menu selection, since 63 | Pidgin converts those character sequences to Unicode arrows. 64 | 2) The first two inserted strings are both the name of the plugin, and the 65 | third is the name of the conversation placement option. 66 | 3) The HTML formatting can be adjusted if it makes sense in a particular 67 | locale, but try to keep it consistent with the instructions tab 68 | displayed in the Buddy List before the user defines any accounts. */ 69 | html = g_strdup_printf(_("" 70 | "%s is enabled!\n\n" 71 | "This space is reserved by the %s plugin to display " 72 | "conversations. Individual conversations can be dragged to this " 73 | "area to attach them, or the conversation placement preference at " 74 | "Tools->Preferences can be set to %s to open all new " 75 | "conversations here by default."), 76 | _(PWM_STR_NAME), _(PWM_STR_NAME), _(PWM_STR_CP_BLIST)); 77 | pretty = pidgin_make_pretty_arrows(html); 78 | g_free(html); 79 | gtk_label_set_markup(GTK_LABEL(gtkconv->tab_cont), pretty); 80 | g_free(pretty); 81 | 82 | /* Set up the label so it accepts dropped conversations like the infopane. */ 83 | gtkconv->entry = gtkconv->tab_cont; 84 | gtkconv->infopane = gtkconv->tab_cont; 85 | gtkconv->infopane_hbox = gtkconv->tab_cont; 86 | 87 | /* Store the dummy conversation's pointer on the Buddy List. */ 88 | pwm_store(gtkblist, "fake_tab", gtkconv); 89 | } 90 | 91 | 92 | /** 93 | * Display an instructions tab in the given window 94 | * 95 | * @param[in] gtkblist The Buddy List to display an instructions tab 96 | **/ 97 | void 98 | pwm_show_dummy_conversation(PidginBuddyList *gtkblist) 99 | { 100 | PidginConversation *gtkconv; /*< The fake conversation structure */ 101 | PidginWindow *gtkconvwin; /*< The conversation window tied to gtkblist */ 102 | 103 | gtkconv = pwm_fetch(gtkblist, "fake_tab"); 104 | gtkconvwin = pwm_blist_get_convs(gtkblist); 105 | 106 | /* Sanity check: Ensure the Buddy List is merged and not showing the tab. */ 107 | if ( gtkconvwin == NULL || pidgin_conv_get_window(gtkconv) != NULL ) 108 | return; 109 | 110 | /* Add the instructions tab to the conversations notebook. */ 111 | pidgin_conv_window_add_gtkconv(gtkconvwin, gtkconv); 112 | 113 | /* Remove the "close" button that was just added to the tab label. */ 114 | gtk_widget_destroy(gtkconv->close); 115 | gtkconv->close = NULL; 116 | 117 | /* Show the plugin name and an About icon for those who can see the label. */ 118 | gtk_label_set_text(GTK_LABEL(gtkconv->tab_label), _(PWM_STR_NAME)); 119 | gtk_label_set_text(GTK_LABEL(gtkconv->menu_label), _(PWM_STR_NAME)); 120 | g_object_set(G_OBJECT(gtkconv->icon), "stock", GTK_STOCK_ABOUT, NULL); 121 | g_object_set(G_OBJECT(gtkconv->menu_icon), "stock", GTK_STOCK_ABOUT, NULL); 122 | } 123 | 124 | 125 | /** 126 | * Take down the instructions tab from its parent window 127 | * 128 | * @param[in] gtkblist The Buddy List that owns the dummy conversation UI 129 | **/ 130 | void 131 | pwm_hide_dummy_conversation(PidginBuddyList *gtkblist) 132 | { 133 | PidginConversation *gtkconv; /*< The fake conversation structure */ 134 | PidginWindow *gtkconvwin; /*< The conversation window that has gtkconv */ 135 | 136 | gtkconv = pwm_fetch(gtkblist, "fake_tab"); 137 | gtkconvwin = pidgin_conv_get_window(gtkconv); 138 | 139 | /* Sanity check: If the dummy tab isn't being shown, leave it alone. */ 140 | if ( gtkconvwin == NULL ) 141 | return; 142 | 143 | /* Force-unparent the dummy tab before the slew of callbacks run over it. */ 144 | /* XXX: This is bad, but it stops Message Notifications from exploding. */ 145 | gtkconvwin->gtkconvs = g_list_remove(gtkconvwin->gtkconvs, gtkconv); 146 | 147 | /* Remove the tab from its window. */ 148 | gtkconv->win = NULL; 149 | pidgin_conv_window_remove_gtkconv(gtkconvwin, gtkconv); 150 | } 151 | 152 | 153 | /** 154 | * Free the memory used by the instructions tab 155 | * 156 | * @param[in] gtkblist The Buddy List that owns the dummy conversation UI 157 | **/ 158 | void 159 | pwm_free_dummy_conversation(PidginBuddyList *gtkblist) 160 | { 161 | PidginConversation *gtkconv; /*< The fake conversation structure */ 162 | 163 | gtkconv = pwm_fetch(gtkblist, "fake_tab"); 164 | 165 | /* Sanity check: Ensure the Buddy List has an associated dummy tab. */ 166 | if ( gtkconv == NULL ) 167 | return; 168 | 169 | /* Destroy the label widget, and release the conversation UI memory. */ 170 | pwm_hide_dummy_conversation(gtkblist); 171 | gtk_widget_destroy(gtkconv->tab_cont); 172 | g_free(gtkconv); 173 | pwm_clear(gtkblist, "fake_tab"); 174 | } 175 | -------------------------------------------------------------------------------- /plugin.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file plugin.c 3 | * Connects the plugin's functionality to all the important Pidgin interfaces 4 | * 5 | * @section LICENSE 6 | * Copyright (C) 2012 David Michael 7 | * 8 | * This file is part of Window Merge. 9 | * 10 | * Window Merge is free software: you can redistribute it and/or modify it 11 | * under the terms of the GNU General Public License as published by the Free 12 | * Software Foundation, either version 3 of the License, or (at your option) 13 | * any later version. 14 | * 15 | * Window Merge is distributed in the hope that it will be useful, but WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 18 | * more details. 19 | * 20 | * You should have received a copy of the GNU General Public License along with 21 | * Window Merge. If not, see . 22 | **/ 23 | 24 | #include "plugin.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #include "window_merge.h" 35 | 36 | 37 | /** 38 | * A preference callback to reconstruct the layout panes when settings change 39 | * 40 | * @param[in] name Unused 41 | * @param[in] type Unused 42 | * @param[in] pvalue Pointer to the value of the preference 43 | * @param[in] data Unused 44 | **/ 45 | static void 46 | pref_convs_side_cb(U const char *name, U PurplePrefType type, 47 | gconstpointer pvalue, U gpointer data) 48 | { 49 | PidginBuddyList *gtkblist; /*< The Buddy List being restructured */ 50 | 51 | /* XXX: There should be an interface to list available Buddy List windows. */ 52 | gtkblist = pidgin_blist_get_default_gtk_blist(); 53 | 54 | pwm_create_paned_layout(gtkblist, pvalue); 55 | } 56 | 57 | 58 | /** 59 | * A callback for when a conversation is opened 60 | * 61 | * This will simply remove the instructions tab when a conversation is opened 62 | * in a notebook that is displaying it. 63 | * 64 | * @param[in] conv The new conversation 65 | **/ 66 | static void 67 | conversation_created_cb(PurpleConversation *conv) 68 | { 69 | PidginConversation *gtkconv; /*< The new Pidgin conversation */ 70 | PidginBuddyList *gtkblist; /*< The Buddy List associated with conv */ 71 | PidginWindow *gtkconvwin; /*< The conversation window that owns conv */ 72 | 73 | if ( conv == NULL ) 74 | return; 75 | 76 | gtkconv = PIDGIN_CONVERSATION(conv); 77 | gtkconvwin = pidgin_conv_get_window(gtkconv); 78 | gtkblist = pwm_convs_get_blist(gtkconvwin); 79 | 80 | /* Sanity check: This callback should only continue for merged windows. */ 81 | if ( gtkblist == NULL ) 82 | return; 83 | 84 | /* If there is a tab in addition to the instructions tab, remove it. */ 85 | if ( pidgin_conv_window_get_gtkconv_count(gtkconvwin) > 1 ) { 86 | pwm_hide_dummy_conversation(gtkblist); 87 | pwm_set_conv_menus_visible(gtkblist, TRUE); 88 | 89 | /* Process queued focus events, and focus the conversation entry field. */ 90 | while ( gtk_events_pending() ) 91 | gtk_main_iteration(); 92 | gtk_widget_grab_focus(gtkconv->entry); 93 | } 94 | } 95 | 96 | 97 | /** 98 | * A callback for when a conversation is being closed 99 | * 100 | * This is only used to display help, hide conversation menu items, and reset 101 | * the window title when the last conversation in the Buddy List window is 102 | * being closed. 103 | * 104 | * @param[in] conv The conversation on its way out the door 105 | **/ 106 | static void 107 | deleting_conversation_cb(PurpleConversation *conv) 108 | { 109 | PidginBuddyList *gtkblist; /*< The Buddy List associated with conv */ 110 | PidginWindow *gtkconvwin; /*< The conversation window that owns conv */ 111 | 112 | if ( conv == NULL ) 113 | return; 114 | 115 | gtkconvwin = pidgin_conv_get_window(PIDGIN_CONVERSATION(conv)); 116 | gtkblist = pwm_convs_get_blist(gtkconvwin); 117 | 118 | /* Sanity check: This callback should only continue for merged windows. */ 119 | if ( gtkblist == NULL ) 120 | return; 121 | 122 | /* If the last conv is being deleted, reset help, icons, title, and menu. */ 123 | if ( pidgin_conv_window_get_gtkconv_count(gtkconvwin) <= 1 ) { 124 | pwm_show_dummy_conversation(gtkblist); 125 | gtk_window_set_icon_list(GTK_WINDOW(gtkblist->window), NULL); 126 | gtk_window_set_title(GTK_WINDOW(gtkblist->window), 127 | pwm_fetch(gtkblist, "title")); 128 | pwm_set_conv_menus_visible(gtkblist, FALSE); 129 | } 130 | } 131 | 132 | 133 | /** 134 | * A callback for when a conversation tab is being dragged out of its window 135 | * 136 | * The only purpose this serves is to treat dragging a conversation out of a 137 | * Buddy List as if it was being deleted, in terms of when to create a dummy 138 | * conversation tab. 139 | * 140 | * @param[in] src The window from which a conversation is being dragged 141 | * @param[in] dst The window where a conversation is being dropped 142 | **/ 143 | static void 144 | conversation_dragging_cb(PidginWindow *src, PidginWindow *dst) 145 | { 146 | if ( src != dst && pwm_convs_get_blist(src) != NULL ) 147 | deleting_conversation_cb(pidgin_conv_window_get_active_conversation(src)); 148 | } 149 | 150 | 151 | /** 152 | * A callback for when a conversation is hidden (moved to a hidden window) 153 | * 154 | * This simply treats the conversation as if it was deleted, or dragged out of 155 | * its parent window. The dummy conversation's tab needs to be handled in the 156 | * same manner for this case. 157 | * 158 | * @param[in] gtkconv The conversation that is being hidden 159 | **/ 160 | static void 161 | conversation_hiding_cb(PidginConversation *gtkconv) 162 | { 163 | if ( gtkconv != NULL ) 164 | deleting_conversation_cb(gtkconv->active_conv); 165 | } 166 | 167 | 168 | /** 169 | * A callback for when the selected tab changes 170 | * 171 | * The important cases caught by this function are when conversations are 172 | * dragged into a window displaying the instructions tab and automatically 173 | * selected. The event will just be handled as if the conversation was newly 174 | * created in that window. 175 | * 176 | * This signal is used because there is no "conversation-dragged". The signal 177 | * for dragging is emitted before the conversation is moved, so everything 178 | * would explode if the instruction label's tab is removed at that point. This 179 | * is executed to remove it after a real conversation was moved and selected. 180 | * 181 | * @param[in] conv The new active conversation 182 | **/ 183 | static void 184 | conversation_switched_cb(PurpleConversation *conv) 185 | { 186 | conversation_created_cb(conv); 187 | } 188 | 189 | 190 | /** 191 | * A callback for when a Buddy List is created to merge a conv window with it 192 | * 193 | * @param[in] blist The Buddy List that was created 194 | **/ 195 | static void 196 | gtkblist_created_cb(U PurpleBuddyList *blist) 197 | { 198 | pwm_merge_conversation(PIDGIN_BLIST(blist)); 199 | } 200 | 201 | 202 | /** 203 | * A conversation placement function to attach convs to the default Buddy List 204 | * 205 | * @param[in] gtkconv Pointer to a new conversation GUI needing to be placed 206 | **/ 207 | static void 208 | conv_placement_by_blist(PidginConversation *gtkconv) 209 | { 210 | PidginBuddyList *gtkblist; /*< The default Buddy List, to own the conv */ 211 | PidginWindow *gtkconvwin; /*< The Buddy List's associated conv window */ 212 | 213 | gtkblist = pidgin_blist_get_default_gtk_blist(); 214 | gtkconvwin = pwm_blist_get_convs(gtkblist); 215 | 216 | if ( gtkconvwin != NULL ) 217 | pidgin_conv_window_add_gtkconv(gtkconvwin, gtkconv); 218 | 219 | /* XXX: A fallback placement avoids segfaults after the plugin's disabled. */ 220 | else 221 | pidgin_conv_placement_get_fnc("last")(gtkconv); 222 | } 223 | 224 | 225 | /** 226 | * The plugin's load function 227 | * 228 | * @param[in] plugin Pointer to the plugin 229 | * @return Whether to continue loading 230 | **/ 231 | static gboolean 232 | plugin_load(PurplePlugin *plugin) 233 | { 234 | PidginBuddyList *gtkblist; /*< For determining if blist was initialized */ 235 | void *conv_handle; /*< The conversations handle */ 236 | void *gtkblist_handle; /*< The Pidgin Buddy List handle */ 237 | void *gtkconv_handle; /*< The Pidgin conversations handle */ 238 | 239 | /* XXX: There should be an interface to list available Buddy List windows. */ 240 | gtkblist = pidgin_blist_get_default_gtk_blist(); 241 | conv_handle = purple_conversations_get_handle(); 242 | gtkblist_handle = pidgin_blist_get_handle(); 243 | gtkconv_handle = pidgin_conversations_get_handle(); 244 | 245 | /* Add the conversation placement option provided by this plugin. */ 246 | pidgin_conv_placement_add_fnc(PLUGIN_TOKEN, _(PWM_STR_CP_BLIST), 247 | &conv_placement_by_blist); 248 | purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement"); 249 | 250 | /* Rebuild the layout when the preference changes. */ 251 | purple_prefs_connect_callback(plugin, PREF_SIDE, pref_convs_side_cb, NULL); 252 | 253 | /* Toggle the instruction panel as conversations come and go. */ 254 | purple_signal_connect(conv_handle, "conversation-created", plugin, 255 | PURPLE_CALLBACK(conversation_created_cb), NULL); 256 | purple_signal_connect(conv_handle, "deleting-conversation", plugin, 257 | PURPLE_CALLBACK(deleting_conversation_cb), NULL); 258 | purple_signal_connect(gtkconv_handle, "conversation-dragging", plugin, 259 | PURPLE_CALLBACK(conversation_dragging_cb), NULL); 260 | purple_signal_connect(gtkconv_handle, "conversation-hiding", plugin, 261 | PURPLE_CALLBACK(conversation_hiding_cb), NULL); 262 | purple_signal_connect(gtkconv_handle, "conversation-switched", plugin, 263 | PURPLE_CALLBACK(conversation_switched_cb), NULL); 264 | 265 | /* Hijack Buddy Lists as they are created. */ 266 | purple_signal_connect(gtkblist_handle, "gtkblist-created", plugin, 267 | PURPLE_CALLBACK(gtkblist_created_cb), NULL); 268 | 269 | /* If a default Buddy List is already available, use it immediately. */ 270 | if ( gtkblist != NULL && gtkblist->window != NULL ) 271 | pwm_merge_conversation(gtkblist); 272 | 273 | return TRUE; 274 | } 275 | 276 | 277 | /** 278 | * The plugin's unload function 279 | * 280 | * @param[in] plugin Unused 281 | * @return Whether to continue unloading 282 | **/ 283 | static gboolean 284 | plugin_unload(U PurplePlugin *plugin) 285 | { 286 | /* Remove the conversation placement option. */ 287 | pidgin_conv_placement_remove_fnc(PLUGIN_TOKEN); 288 | purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement"); 289 | 290 | /* XXX: There should be an interface to list available Buddy List windows. */ 291 | pwm_split_conversation(pidgin_blist_get_default_gtk_blist()); 292 | 293 | return TRUE; 294 | } 295 | 296 | 297 | /** 298 | * Create the plugin's preferences window 299 | * 300 | * @param[in] plugin Unused 301 | * @return Pointer to the newly created preferences window 302 | **/ 303 | static PurplePluginPrefFrame * 304 | get_plugin_pref_frame(U PurplePlugin *plugin) 305 | { 306 | PurplePluginPrefFrame *frame; /*< The plugin preferences window frame */ 307 | PurplePluginPref *ppref; /*< A plugin preference option */ 308 | 309 | frame = purple_plugin_pref_frame_new(); 310 | 311 | /* TRANSLATORS: This is the name of the plugin preference for deciding the 312 | orientation of the panes created for the Buddy List and conversations. */ 313 | ppref = purple_plugin_pref_new_with_name_and_label(PREF_SIDE, _("" 314 | "Conversation pane location")); 315 | purple_plugin_pref_set_type(ppref, PURPLE_PLUGIN_PREF_CHOICE); 316 | 317 | /* TRANSLATORS: This value means: Buddy List left, conversations right. */ 318 | purple_plugin_pref_add_choice(ppref, _("Right of Buddy List"), "right"); 319 | 320 | /* TRANSLATORS: This value means: conversations left, Buddy List right. */ 321 | purple_plugin_pref_add_choice(ppref, _("Left of Buddy List"), "left"); 322 | 323 | /* TRANSLATORS: This value means: conversations top, Buddy List bottom. */ 324 | purple_plugin_pref_add_choice(ppref, _("Above Buddy List"), "top"); 325 | 326 | /* TRANSLATORS: This value means: Buddy List top, conversations bottom. */ 327 | purple_plugin_pref_add_choice(ppref, _("Below Buddy List"), "bottom"); 328 | 329 | purple_plugin_pref_frame_add(frame, ppref); 330 | 331 | return frame; 332 | } 333 | 334 | /** 335 | * The plugin API's UI structure for registering the preferences window 336 | **/ 337 | static PurplePluginUiInfo prefs_info = { 338 | get_plugin_pref_frame, 339 | 0, 340 | NULL, 341 | 342 | NULL, 343 | NULL, 344 | NULL, 345 | NULL 346 | }; 347 | 348 | 349 | /** 350 | * The plugin's init function, used to define plugin preferences 351 | * 352 | * @param[in] plugin The libpurple plugin structure being initialized 353 | **/ 354 | static void 355 | plugin_init(PurplePlugin *plugin) 356 | { 357 | #ifdef ENABLE_NLS 358 | bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); 359 | bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); 360 | #endif 361 | plugin->info->name = _(plugin->info->name); 362 | plugin->info->summary = _(plugin->info->summary); 363 | plugin->info->description = _(plugin->info->description); 364 | plugin->info->author = _(plugin->info->author); 365 | 366 | /* Initialize the root of the plugin's preferences path. */ 367 | purple_prefs_add_none(PREF_ROOT); 368 | 369 | /* Set the default size of the Buddy List in vertical panes. */ 370 | purple_prefs_add_int(PREF_HEIGHT, 300); 371 | 372 | /* Set the default size of the Buddy List in horizontal panes. */ 373 | purple_prefs_add_int(PREF_WIDTH, 300); 374 | 375 | /* Set the default side of the Buddy List window to attach conversations. */ 376 | purple_prefs_add_string(PREF_SIDE, "right"); 377 | } 378 | 379 | /** 380 | * The plugin information to be fed to the plugin API 381 | **/ 382 | static PurplePluginInfo info = { 383 | PURPLE_PLUGIN_MAGIC, 384 | PURPLE_MAJOR_VERSION, 385 | PURPLE_MINOR_VERSION, 386 | PURPLE_PLUGIN_STANDARD, 387 | PIDGIN_PLUGIN_TYPE, 388 | 0, 389 | NULL, 390 | PURPLE_PRIORITY_DEFAULT, 391 | 392 | PLUGIN_ID, 393 | PLUGIN_NAME, 394 | PLUGIN_VERSION, 395 | 396 | /* TRANSLATORS: As the plugin summary, this should be able to describe what 397 | the plugin does in one sentence. */ 398 | N_("Merges the Buddy List window with a conversation window"), 399 | 400 | /* TRANSLATORS: This is the plugin description, so you can use as much 401 | writing as needed to describe what the plugin can do. */ 402 | N_("Enabling this plugin will allow conversations to be attached to the " 403 | "Buddy List window. Preferences are available to customize the plugin's " 404 | "panel layout."), 405 | 406 | /* TRANSLATORS: This is a proper name, so you shouldn't have to modify it 407 | unless you are transliterating to a non-Latin script. */ 408 | N_("David Michael "), 409 | 410 | PLUGIN_URL, 411 | 412 | plugin_load, 413 | plugin_unload, 414 | NULL, 415 | 416 | NULL, 417 | NULL, 418 | &prefs_info, 419 | NULL, 420 | 421 | NULL, 422 | NULL, 423 | NULL, 424 | NULL 425 | }; 426 | 427 | PURPLE_INIT_PLUGIN(PLUGIN_TOKEN, plugin_init, info) 428 | -------------------------------------------------------------------------------- /merge.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file merge.c 3 | * Deals with the widgets of the merged window panes and menu bar 4 | * 5 | * @section LICENSE 6 | * Copyright (C) 2012 David Michael 7 | * 8 | * This file is part of Window Merge. 9 | * 10 | * Window Merge is free software: you can redistribute it and/or modify it 11 | * under the terms of the GNU General Public License as published by the Free 12 | * Software Foundation, either version 3 of the License, or (at your option) 13 | * any later version. 14 | * 15 | * Window Merge is distributed in the hope that it will be useful, but WITHOUT 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 18 | * more details. 19 | * 20 | * You should have received a copy of the GNU General Public License along with 21 | * Window Merge. If not, see . 22 | **/ 23 | 24 | #include "plugin.h" 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | 34 | #include "window_merge.h" 35 | 36 | 37 | /** 38 | * A callback for when the position of a GtkPaned slider changes 39 | * 40 | * This function is responsible for storing the width or height of the Buddy 41 | * List as a preference after the user changes it by dragging the slider. 42 | * 43 | * @param[in] gobject Pointer to the GtkPaned structure that was resized 44 | * @param[in] pspec Unused 45 | * @param[in] data Pointer to the Buddy List that is a parent of gobject 46 | **/ 47 | static void 48 | notify_position_cb(GObject *gobject, U GParamSpec *pspec, gpointer data) 49 | { 50 | PidginBuddyList *gtkblist; /*< Buddy List window containing these panes */ 51 | gint max_position; /*< The "max-position" property of gobject */ 52 | gint size; /*< Current size of the Buddy List pane */ 53 | 54 | gtkblist = data; 55 | size = gtk_paned_get_position(GTK_PANED(gobject)); 56 | 57 | /* If the Buddy List is not the first pane, invert the size preference. */ 58 | if ( gtk_paned_get_child1(GTK_PANED(gobject)) != gtkblist->notebook ) { 59 | g_object_get(gobject, "max-position", &max_position, NULL); 60 | size = max_position - size; 61 | } 62 | 63 | /* Store this size as a user preference (depending on paned orientation). */ 64 | if ( GTK_IS_VPANED(gobject) ) 65 | purple_prefs_set_int(PREF_HEIGHT, size); 66 | else 67 | purple_prefs_set_int(PREF_WIDTH, size); 68 | } 69 | 70 | 71 | /** 72 | * A callback for when the total size of a GtkPaned changes 73 | * 74 | * This should be called after a new GtkPaned finds its parent and calculates 75 | * its "max-position" property. It is only intended to be run on this single 76 | * occassion, so it removes itself on completion. The call is used to set the 77 | * initial size of the Buddy List to the user's preference. 78 | * 79 | * @param[in] gobject Pointer to the GtkPaned structure that was resized 80 | * @param[in] pspec Unused 81 | * @param[in] data Pointer to the Buddy List that is a parent of gobject 82 | **/ 83 | static void 84 | notify_max_position_cb(GObject *gobject, U GParamSpec *pspec, gpointer data) 85 | { 86 | PidginBuddyList *gtkblist; /*< Buddy List window containing these panes */ 87 | gint max_position; /*< The "max-position" property of gobject */ 88 | gint size; /*< Desired size of the Buddy List pane */ 89 | 90 | gtkblist = data; 91 | 92 | /* Fetch the user's preferred Buddy List size (depending on orientation). */ 93 | if ( GTK_IS_VPANED(gobject) ) 94 | size = purple_prefs_get_int(PREF_HEIGHT); 95 | else 96 | size = purple_prefs_get_int(PREF_WIDTH); 97 | 98 | /* If the Buddy List is not the first pane, invert the size preference. */ 99 | if ( gtk_paned_get_child1(GTK_PANED(gobject)) != gtkblist->notebook ) { 100 | g_object_get(gobject, "max-position", &max_position, NULL); 101 | size = max_position - size; 102 | } 103 | 104 | /* Adjust the panes' slider to set the Buddy List to its desired size. */ 105 | gtk_paned_set_position(GTK_PANED(gobject), size); 106 | 107 | /* Disconnect this callback. This initial setting was only needed once. */ 108 | g_object_disconnect(gobject, "any_signal", 109 | G_CALLBACK(notify_max_position_cb), data, NULL); 110 | 111 | /* Now that system-induced slider changes are done, monitor user changes. */ 112 | g_object_connect(gobject, "signal::notify::position", 113 | G_CALLBACK(notify_position_cb), data, NULL); 114 | } 115 | 116 | 117 | /** 118 | * Pass a focus (in) event from one widget to another 119 | * 120 | * This is only used to trigger the signal handlers on the conversation window 121 | * for removing message notifications when the Buddy List window is focused. 122 | * 123 | * @param[in] widget Unused 124 | * @param[in] event Unused 125 | * @param[in] data Pointer to the widget to receive the passed event 126 | * @return Whether to stop processing other event handlers 127 | **/ 128 | static gboolean 129 | focus_in_event_cb(U GtkWidget *widget, U GdkEventFocus *event, gpointer data) 130 | { 131 | GtkWidget *other_widget; /*< Widget pretending to receive an event */ 132 | GdkWindow *window; /*< Window of the widget receiving the event */ 133 | GdkEvent *focus; /*< New focus event for the specified widget */ 134 | 135 | focus = gdk_event_new(GDK_FOCUS_CHANGE); 136 | other_widget = data; 137 | window = gtk_widget_get_window(other_widget); 138 | 139 | focus->focus_change.window = g_object_ref(window); 140 | focus->focus_change.send_event = TRUE; 141 | focus->focus_change.in = TRUE; 142 | 143 | gtk_widget_event(other_widget, focus); 144 | 145 | gdk_event_free(focus); 146 | 147 | return FALSE; 148 | } 149 | 150 | 151 | /** 152 | * Create a conversation window and merge it with the given Buddy List window 153 | * 154 | * This is the real core of the plugin right here. It initializes the Buddy 155 | * List with a conversation window just like the project advertises. See the 156 | * function pwm_split_conversation() to reverse this effect. 157 | * 158 | * @param[in] gtkblist The Buddy List that will be able to show conversations 159 | **/ 160 | void 161 | pwm_merge_conversation(PidginBuddyList *gtkblist) 162 | { 163 | PidginWindow *gtkconvwin; /*< The mutilated conversations for gtkblist */ 164 | GtkBindingSet *binding_set; /*< The binding set of GtkIMHtml widgets */ 165 | 166 | /* Sanity check: If the Buddy List is already merged, don't mess with it. */ 167 | if ( pwm_blist_get_convs(gtkblist) != NULL ) 168 | return; 169 | 170 | binding_set = gtk_binding_set_by_class(g_type_class_ref(GTK_TYPE_IMHTML)); 171 | gtkconvwin = pidgin_conv_window_new(); 172 | 173 | /* Tie the Buddy List and conversation window instances together. */ 174 | g_object_set_data(G_OBJECT(gtkblist->notebook), "pwm_convs", gtkconvwin); 175 | g_object_set_data(G_OBJECT(gtkconvwin->notebook), "pwm_blist", gtkblist); 176 | 177 | /* Backup the Buddy List window title for restoring it later. */ 178 | pwm_store(gtkblist, "title", 179 | g_strdup(gtk_window_get_title(GTK_WINDOW(gtkblist->window)))); 180 | 181 | /* Move the conversation notebook into the Buddy List window. */ 182 | pwm_create_paned_layout(gtkblist, purple_prefs_get_string(PREF_SIDE)); 183 | 184 | /* Display the instructions tab for new users. */ 185 | pwm_init_dummy_conversation(gtkblist); 186 | pwm_show_dummy_conversation(gtkblist); 187 | 188 | /* Pass focus events from Buddy List to conversation window. */ 189 | g_object_connect(G_OBJECT(gtkblist->window), "signal::focus-in-event", 190 | G_CALLBACK(focus_in_event_cb), gtkconvwin->window, NULL); 191 | 192 | /* Point the conversation window structure at the Buddy List's window. */ 193 | pwm_store(gtkblist, "conv_window", gtkconvwin->window); 194 | gtkconvwin->window = gtkblist->window; 195 | 196 | /* Block these "move-cursor" bindings for conversation event handlers. */ 197 | /* XXX: These are skipped in any GtkIMHtml, not just the conversations. */ 198 | /* XXX: Furthermore, there is no event to undo this effect. */ 199 | gtk_binding_entry_skip(binding_set, GDK_Up, GDK_CONTROL_MASK); 200 | gtk_binding_entry_skip(binding_set, GDK_Down, GDK_CONTROL_MASK); 201 | gtk_binding_entry_skip(binding_set, GDK_Page_Up, GDK_CONTROL_MASK); 202 | gtk_binding_entry_skip(binding_set, GDK_Page_Down, GDK_CONTROL_MASK); 203 | gtk_binding_entry_skip(binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK); 204 | gtk_binding_entry_skip(binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK); 205 | gtk_binding_entry_skip(binding_set, GDK_Tab, GDK_CONTROL_MASK); 206 | gtk_binding_entry_skip(binding_set, GDK_KP_Tab, GDK_CONTROL_MASK); 207 | gtk_binding_entry_skip(binding_set, GDK_ISO_Left_Tab, GDK_CONTROL_MASK); 208 | } 209 | 210 | 211 | /** 212 | * Restore the Buddy List to its former glory by splitting off conversations 213 | * 214 | * This effectively will undo everything done by pwm_merge_conversation(). The 215 | * Buddy List should be returned to its original state, and any conversations 216 | * should be in a separate window. 217 | * 218 | * @param[in] gtkblist The Buddy List that has had enough of this plugin 219 | **/ 220 | void 221 | pwm_split_conversation(PidginBuddyList *gtkblist) 222 | { 223 | PidginWindow *gtkconvwin; /*< Conversation window merged into gtkblist */ 224 | GtkWidget *paned; /*< The panes on the Buddy List window */ 225 | gchar *title; /*< Original title of the Buddy List window */ 226 | 227 | gtkconvwin = pwm_blist_get_convs(gtkblist); 228 | paned = pwm_fetch(gtkblist, "paned"); 229 | title = pwm_fetch(gtkblist, "title"); 230 | 231 | /* Ensure the conversation window's menu items are returned. */ 232 | pwm_set_conv_menus_visible(gtkblist, FALSE); 233 | 234 | /* End the association between the Buddy List and its conversation window. */ 235 | g_object_steal_data(G_OBJECT(gtkblist->notebook), "pwm_convs"); 236 | g_object_steal_data(G_OBJECT(gtkconvwin->notebook), "pwm_blist"); 237 | 238 | /* Point the conversation window's structure back to its original window. */ 239 | gtkconvwin->window = pwm_fetch(gtkblist, "conv_window"); 240 | pwm_clear(gtkblist, "conv_window"); 241 | 242 | /* Stop passing focus events from Buddy List to conversation window. */ 243 | g_object_disconnect(G_OBJECT(gtkblist->window), "any_signal", 244 | G_CALLBACK(focus_in_event_cb), gtkconvwin->window, NULL); 245 | 246 | /* Restore the conversation window's notebook. */ 247 | pwm_widget_replace(pwm_fetch(gtkblist, "placeholder"), 248 | gtkconvwin->notebook, NULL); 249 | pwm_clear(gtkblist, "placeholder"); 250 | 251 | /* Free the dummy conversation, and display the window if it survives. */ 252 | pwm_free_dummy_conversation(gtkblist); 253 | if ( g_list_find(pidgin_conv_windows_get_list(), gtkconvwin) != NULL ) 254 | pidgin_conv_window_show(gtkconvwin); 255 | 256 | /* Restore the Buddy List's original structure, and destroy the panes. */ 257 | pwm_widget_replace(paned, gtkblist->notebook, NULL); 258 | pwm_clear(gtkblist, "paned"); 259 | 260 | /* Restore the window title and icons from before conversations set them. */ 261 | gtk_window_set_icon_list(GTK_WINDOW(gtkblist->window), NULL); 262 | gtk_window_set_title(GTK_WINDOW(gtkblist->window), title); 263 | g_free(title); 264 | pwm_clear(gtkblist, "title"); 265 | } 266 | 267 | 268 | /** 269 | * Construct (or reconstruct when settings change) the window's paned layout 270 | * 271 | * It is worth noting that the string preferences only use the first character 272 | * to determine orientation since they are all unique (and it avoids calling 273 | * extra string functions). The full strings are just for readable prefs.xml. 274 | * 275 | * @param[in] gtkblist The Buddy List that needs a new paned window structure 276 | * @param[in] side The pref where convs are placed relative to the blist 277 | * 278 | * @note This is structured to default to "right" on an invalid pref setting. 279 | **/ 280 | void 281 | pwm_create_paned_layout(PidginBuddyList *gtkblist, const char *side) 282 | { 283 | PidginWindow *gtkconvwin; /*< Conversation window merged into gtkblist */ 284 | GtkWidget *old_paned; /*< The existing paned layout, if it exists */ 285 | GtkWidget *paned; /*< The new layout panes being created */ 286 | GtkWidget *placeholder; /*< Marks the conv notebook's original spot */ 287 | GValue value = G_VALUE_INIT; /*< For passing a property value to a widget */ 288 | 289 | gtkconvwin = pwm_blist_get_convs(gtkblist); 290 | old_paned = pwm_fetch(gtkblist, "paned"); 291 | 292 | /* Create the requested vertical or horizontal paned layout. */ 293 | if ( side != NULL && (*side == 't' || *side == 'b') ) 294 | paned = gtk_vpaned_new(); 295 | else 296 | paned = gtk_hpaned_new(); 297 | gtk_widget_show(paned); 298 | pwm_store(gtkblist, "paned", paned); 299 | 300 | /* When the size of the panes is determined, reset the Buddy List size. */ 301 | g_object_connect(G_OBJECT(paned), "signal::notify::max-position", 302 | G_CALLBACK(notify_max_position_cb), gtkblist, NULL); 303 | 304 | /* If the Buddy List is pristine, make the panes and replace its notebook. */ 305 | if ( old_paned == NULL ) { 306 | placeholder = gtk_label_new(NULL); 307 | if ( side != NULL && (*side == 't' || *side == 'l') ) { 308 | pwm_widget_replace(gtkconvwin->notebook, placeholder, paned); 309 | pwm_widget_replace(gtkblist->notebook, paned, paned); 310 | } else { 311 | pwm_widget_replace(gtkblist->notebook, paned, paned); 312 | pwm_widget_replace(gtkconvwin->notebook, placeholder, paned); 313 | } 314 | pwm_store(gtkblist, "placeholder", placeholder); 315 | } 316 | 317 | /* If existing panes are being replaced, define the new layout and use it. */ 318 | else { 319 | if ( side != NULL && (*side == 't' || *side == 'l') ) { 320 | gtk_widget_reparent(gtkconvwin->notebook, paned); 321 | gtk_widget_reparent(gtkblist->notebook, paned); 322 | } else { 323 | gtk_widget_reparent(gtkblist->notebook, paned); 324 | gtk_widget_reparent(gtkconvwin->notebook, paned); 325 | } 326 | pwm_widget_replace(old_paned, paned, NULL); 327 | } 328 | 329 | /* Make conversations resize with the window so the Buddy List is fixed. */ 330 | g_value_init(&value, G_TYPE_BOOLEAN); 331 | g_value_set_boolean(&value, TRUE); 332 | gtk_container_child_set_property(GTK_CONTAINER(paned), gtkconvwin->notebook, 333 | "resize", &value); 334 | g_value_set_boolean(&value, FALSE); 335 | gtk_container_child_set_property(GTK_CONTAINER(paned), gtkblist->notebook, 336 | "resize", &value); 337 | } 338 | 339 | 340 | /** 341 | * Toggle the visibility of conversation window menu items 342 | * 343 | * The method of hiding the menu items is to reparent them back into their 344 | * original (still hidden) parent window. This avoids conflicting with other 345 | * "hiding" methods used by plugins, such as widget sensitivity or visibility. 346 | * 347 | * When migrating to the Buddy List, left-justified items are inserted after 348 | * the last left-justified item. Right-justified items are inserted before the 349 | * first right-justified item. This appears to append conversation menu items 350 | * while keeping the Buddy List's notification icon on the far right. 351 | * 352 | * When migrating back to the conversation window, left-justified items are 353 | * prepended to all items. Right-justified items are inserted before the first 354 | * right-justified item. This gives the appearance of appending any newly 355 | * added menu items when they are all migrated to the Buddy List again. 356 | * 357 | * @param[in] gtkblist The Buddy List whose menu needs adjusting 358 | * @param[in] visible Whether the menu items are being shown or hidden 359 | **/ 360 | void 361 | pwm_set_conv_menus_visible(PidginBuddyList *gtkblist, gboolean visible) 362 | { 363 | PidginWindow *gtkconvwin; /*< Conversation window merged into gtkblist */ 364 | GtkMenu *submenu; /*< A submenu of a conversation menu item */ 365 | GtkContainer *from_menu; /*< Menu bar of the window losing the items */ 366 | GtkContainer *to_menu; /*< Menu bar of the window gaining the items */ 367 | GtkWidget *blist_menu; /*< The Buddy List menu bar */ 368 | GtkWidget *convs_menu; /*< The conversation window menu bar */ 369 | GtkWidget *item; /*< A menu item widget being transferred */ 370 | GList *children; /*< List of menu items in a given window */ 371 | GList *child; /*< A menu item in the list (iteration) */ 372 | GList *migrated_items; /*< List of items added to the Buddy List */ 373 | gint index_left; /*< Position to insert left-justified items */ 374 | gint index_right; /*< Position to insert right-justified items */ 375 | 376 | gtkconvwin = pwm_blist_get_convs(gtkblist); 377 | 378 | /* Sanity check: Only act on a merged Buddy List window. */ 379 | if ( gtkconvwin == NULL ) 380 | return; 381 | 382 | blist_menu = gtk_widget_get_parent(gtkblist->menutray); 383 | convs_menu = gtkconvwin->menu.menubar; 384 | from_menu = GTK_CONTAINER(visible ? convs_menu : blist_menu); 385 | to_menu = GTK_CONTAINER(visible ? blist_menu : convs_menu); 386 | migrated_items = pwm_fetch(gtkblist, "conv_menus"); 387 | 388 | /* XXX: Drop the "Send To" menu to avoid segfaults. */ 389 | if ( visible && gtkconvwin->menu.send_to != NULL ) { 390 | gtk_widget_destroy(gtkconvwin->menu.send_to); 391 | gtkconvwin->menu.send_to = NULL; 392 | } 393 | 394 | /* Locate the position before the first right-aligned menu item. */ 395 | index_right = 0; 396 | children = gtk_container_get_children(to_menu); 397 | for ( child = children; child != NULL; child = child->next ) 398 | if ( gtk_menu_item_get_right_justified(GTK_MENU_ITEM(child->data)) ) 399 | break; 400 | else 401 | index_right++; 402 | g_list_free(children); 403 | index_left = visible ? index_right : 0; 404 | 405 | /* Loop over each conversation menu item to move it to its destination. */ 406 | children = visible ? gtk_container_get_children(from_menu) : migrated_items; 407 | for ( child = children; child != NULL; child = child->next ) { 408 | item = GTK_WIDGET(child->data); 409 | 410 | /* Reparent the item into the window based on existing justified items. */ 411 | g_object_ref_sink(G_OBJECT(item)); 412 | gtk_container_remove(from_menu, item); 413 | if ( gtk_menu_item_get_right_justified(GTK_MENU_ITEM(item)) ) 414 | gtk_menu_shell_insert(GTK_MENU_SHELL(to_menu), item, index_right); 415 | else 416 | gtk_menu_shell_insert(GTK_MENU_SHELL(to_menu), item, index_left++); 417 | g_object_unref(G_OBJECT(item)); 418 | index_right++; 419 | 420 | /* Register/Unregister its accelerator group with the Buddy List window. */ 421 | submenu = GTK_MENU(gtk_menu_item_get_submenu(GTK_MENU_ITEM(item))); 422 | if ( visible ) 423 | gtk_window_add_accel_group(GTK_WINDOW(gtkblist->window), 424 | gtk_menu_get_accel_group(submenu)); 425 | else 426 | gtk_window_remove_accel_group(GTK_WINDOW(gtkblist->window), 427 | gtk_menu_get_accel_group(submenu)); 428 | 429 | /* Add this menu item to the list for later restoration, if necessary. */ 430 | if ( visible ) 431 | migrated_items = g_list_append(migrated_items, child->data); 432 | } 433 | g_list_free(children); 434 | 435 | /* Update the stored pointer to the list of migrated items. */ 436 | if ( visible ) 437 | pwm_store(gtkblist, "conv_menus", migrated_items); 438 | else 439 | pwm_clear(gtkblist, "conv_menus"); 440 | } 441 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------