hybrid
hybrid copied to clipboard
不支持unity
目前不支持unity的通知机制,unity没有statusicon了,我自己改了个支持indicator的,但还有缺陷,作者打算将来支持吗?话说你的编译环境有点老?库都老了。
commit db20b7754f9a4e6d30a7541bd7f92063d9f7ca5c Merge: 46c71c0 33693da Author: = <=> Date: Fri Dec 30 15:10:35 2011 +0800
Merge branch 'master' of github.com:levin108/hybrid
Conflicts:
CMakeLists.txt
src/conv.c
diff --cc CMakeLists.txt index 78cfb05,7424c01..e243cfa --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -105,9 -106,9 +106,10 @@@ if(WITH_NETWORKMANAGER endif(WITH_NETWORKMANAGER)
if(WITH_INDICATE)
- pkg_check_modules(INDICATE indicate)
- pkg_check_modules(INDICATE_GTK indicate-gtk)
- pkg_check_modules(INDICATE_GTK_NEW indicate-gtk-0.5)
- pkg_check_modules(INDICATE indicate-0.6)
- pkg_check_modules(INDICATE_GTK indicate-gtk3)
- pkg_check_modules(INDICATE_GTK_NEW indicate-gtk3-0.6) ++ endif(WITH_INDICATE)
if(WITH_LIBNOTIFY AND LIBNOTIFY_FOUND) @@@ -210,65 -210,64 +211,67 @@@ if(WITH_NETWORKMANAGER AND NETWORKMANAG endif(WITH_NETWORKMANAGER AND NETWORKMANAGER_FOUND)
if (WITH_WEBKIT AND WEBKIT_FOUND)
- include_directories(${WEBKIT_INCLUDE_DIRS})
- include_directories(${WEBKIT_INCLUDE_DIRS}) endif(WITH_WEBKIT AND WEBKIT_FOUND)
-if(WITH_INDICATE AND INDICATE_FOUND AND INDICATE_GTK_FOUND)
- include_directories(${INDICATE_INCLUDE_DIRS})
- include_directories(${INDICATE_GTK_INCLUDE_DIRS}) -endif(WITH_INDICATE AND INDICATE_FOUND AND INDICATE_GTK_FOUND) ++ +if(WITH_INDICATE AND INDICATE_FOUND AND (INDICATE_GTK_FOUND OR INDICATE_GTK_NEW_FOUND))
- include_directories(${INDICATE_INCLUDE_DIRS})
- include_directories(${INDICATE_GTK_INCLUDE_DIRS}) +endif(WITH_INDICATE AND INDICATE_FOUND AND (INDICATE_GTK_FOUND OR INDICATE_GTK_NEW_FOUND))
set(hybrid_SRC
- lib/connect.c
- lib/network.c
- lib/eventloop.c
- lib/module.c
- lib/account.c
- lib/xmlnode.c
- lib/config.c
- lib/util.c
- lib/pref.c
- lib/logs.c
- src/gtkconn.c
- src/gtksound.c
- src/gtkutils.c
- src/gtkaccount.c
- src/blist.c
- src/conv.c
- src/info.c
- src/head.c
- src/action.c
- src/notify.c
- src/tooltip.c
- src/preference.c
- src/chat-textview.c
- src/chat-webkit.c
- src/groupadd.c
- src/buddyadd.c
- src/buddyreq.c
- src/statusicon.c
- src/searchbox.c
- src/confirm.c
- src/about.c
- src/gtkcellrendererexpander.c
- src/core.c
- )
- lib/connect.c
- lib/network.c
- lib/debug.c
- lib/eventloop.c
- lib/module.c
- lib/account.c
- lib/xmlnode.c
- lib/config.c
- lib/util.c
- lib/pref.c
- lib/logs.c
- src/gtkconn.c
- src/gtksound.c
- src/gtkutils.c
- src/gtkaccount.c
- src/blist.c
- src/conv.c
- src/info.c
- src/head.c
- src/action.c
- src/notify.c
- src/tooltip.c
- src/preference.c
- src/chat-textview.c
- src/chat-webkit.c
- src/groupadd.c
- src/buddyadd.c
- src/buddyreq.c
- src/statusicon.c
- src/searchbox.c
- src/confirm.c ++ src/about.c
- src/gtkcellrendererexpander.c
- src/core.c
-
++ src/indicator.c +) +src/indicator.c
- add_executable(hybrid ${hybrid_SRC}) message(STATUS ${GLIB2_LIBRARIES})
- target_link_libraries(hybrid
- ${GOBJECT2_LIBRARIES}
- ${GMODULE2_LIBRARIES}
- ${GTK2_LIBRARIES}
- ${GLIB2_LIBRARIES}
- ${GDKPIXBUF_LIBRARIES}
- ${GTHREAD2_LIBRARIES}
- ${OPENSSL_LIBRARIES}
- ${LIBXML2_LIBRARIES})
- target_link_libraries(hybrid
- ${GOBJECT2_LIBRARIES}
- ${GMODULE2_LIBRARIES}
- ${GTK2_LIBRARIES}
- ${GLIB2_LIBRARIES}
- ${GDKPIXBUF_LIBRARIES}
- ${GTHREAD2_LIBRARIES}
- ${OPENSSL_LIBRARIES}
- ${LIBXML2_LIBRARIES})
if(WITH_LIBNOTIFY AND LIBNOTIFY_FOUND)
-
target_link_libraries(hybrid ${LIBNOTIFY_LIBRARIES})
- target_link_libraries(hybrid ${LIBNOTIFY_LIBRARIES}) endif(WITH_LIBNOTIFY AND LIBNOTIFY_FOUND)
if(WITH_GSTREAMER AND GSTREAMER_FOUND) @@@ -280,17 -279,17 +283,19 @@@ if(WITH_LIBXSS AND LIBXSS_FOUND endif(WITH_LIBXSS AND LIBXSS_FOUND)
if (WITH_WEBKIT AND WEBKIT_FOUND)
- target_link_libraries(hybrid ${WEBKIT_LIBRARIES})
- target_link_libraries(hybrid ${WEBKIT_LIBRARIES}) endif(WITH_WEBKIT AND WEBKIT_FOUND)
-if(WITH_INDICATE AND INDICATE_FOUND AND INDICATE_GTK_FOUND)
- target_link_libraries(hybrid ${INDICATE_LIBRARIES})
- target_link_libraries(hybrid ${INDICATE_GTK_LIBRARIES}) -endif(WITH_INDICATE AND INDICATE_FOUND AND INDICATE_GTK_FOUND) ++ +if(WITH_INDICATE AND INDICATE_FOUND AND (INDICATE_GTK_FOUND OR INDICATE_GTK_NEW_FOUND))
- target_link_libraries(hybrid ${INDICATE_LIBRARIES})
- target_link_libraries(hybrid ${INDICATE_GTK_LIBRARIES}) +endif(WITH_INDICATE AND INDICATE_FOUND AND (INDICATE_GTK_FOUND OR INDICATE_GTK_NEW_FOUND))
- if(WITH_NETWORKMANAGER AND NETWORKMANAGER_FOUND AND DBUSGLIB_FOUND)
-
target_link_libraries(hybrid ${NETWORKMANAGER_LIBRARIES})
-
target_link_libraries(hybrid ${DBUSGLIB_LIBRARIES})
- target_link_libraries(hybrid ${NETWORKMANAGER_LIBRARIES})
- target_link_libraries(hybrid ${DBUSGLIB_LIBRARIES}) endif(WITH_NETWORKMANAGER AND NETWORKMANAGER_FOUND AND DBUSGLIB_FOUND)
install(TARGETS hybrid RUNTIME DESTINATION ${BIN_INSTALL_DIR}) diff --cc src/conv.c index cbb6f1a,cd570dd..ea0a71c --- a/src/conv.c +++ b/src/conv.c @@@ -1313,8 -1310,7 +1312,9 @@@ hybrid_chat_window_create(HybridAccoun
conv->chat_buddies = g_slist_append(conv->chat_buddies, chat);
- init_chat_window(chat); ++
- init_chat_window(chat);
- return chat;
found:
diff --cc src/indicator.c
index 0000000,0000000..f69d9e1
new file mode 100644
--- /dev/null
+++ b/src/indicator.c
@@@ -1,0 -1,0 +1,153 @@@
++#include "config.h"
++#ifdef USE_INDICATE
++#include "indicator.h"
++#include <libindicate/indicator.h>
++#include <libindicate-gtk/indicator.h>
++#include <libindicate/server.h>
++#include <libindicate/indicator-messages.h>
++
++GSList indicators = NULL;
++IndicateServer *indserver = NULL;
++static gint indicate_action();
++static void server_display(IndicateServer *server, const guint timestamp,gpointer data);
++#endif
++
++#ifdef USE_INDICATE
++static gint indicate_action()
++{
++ GSList *iterator = NULL;
++ IndicateIndicator *indicator = NULL;
++ gint count = 0;
++
++
++ for (iterator = indicators; iterator; iterator = iterator->next, count ++) {
++ indicator = (IndicateIndicator)iterator->data;
++ /* clear attention /
++ indicate_indicator_set_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, "");
++ / remove the indicators from the indicate server /
++ indicate_server_remove_indicator(indserver, indicator);
++ }
++
++ / free the memory allocated for the indicator list /
++ g_slist_free(indicators);
++ indicators = NULL;
++
++ if(count == 0) return 0;
++
++ / process the incoming message /
++ clear_indicate_attention();
++
++ return count;
++}
++
++static void message_display(IndicateIndicator *(indicator), gpointer (data))
++{
++ indicate_action();
++}
++
++static IndicateIndicator *get_indicator(IndicateServer *server, const gchar *sid)
++{
++ GSList *iterator = NULL;
++ IndicateIndicator *indicator;
++ const gchar *id;
++ gchar portrait[1024];
++ GdkPixbuf *pixbuf;
++
++ for (iterator = indicators; iterator; iterator = iterator->next) {
++
++ indicator = (IndicateIndicator)iterator->data;
++ id = indicate_indicator_get_property(indicator, "sid");
++
++ if(strcmp(sid, id) == 0) return indicator;
++ }
++
++ /* no indicator found, create one :) /
++ indicator = indicate_indicator_new();
++ / add it to the global indicator list /
++ indicators = g_slist_append(indicators, indicator);
++ indicate_server_add_indicator(server, indicator);
++
++ indicate_indicator_set_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT, "0");
++ indicate_indicator_set_property(indicator, "sid", sid);
++ / set icon /
++ snprintf(portrait, sizeof(portrait) - 1, "%s/%s.jpg", hybrid_config_get_path(), sid);
++ pixbuf = gdk_pixbuf_new_from_file(portrait, NULL);
++ //indicate_indicator_set_property_icon(indicator, INDICATE_INDICATOR_MESSAGES_PROP_ICON, pixbuf);
++ g_object_unref(pixbuf);
++
++ g_signal_connect(G_OBJECT(indicator), INDICATE_INDICATOR_SIGNAL_DISPLAY,
++ G_CALLBACK(message_display), NULL);
++
++ indicate_indicator_show(indicator);
++
++ return indicator;
++}
++
++static void server_display(IndicateServer *server, const guint timestamp,gpointer data)
++{
++ printf("server display");
++ GtkWindow *window = GTK_WINDOW(data);
++ if(indicate_action() == 0) {
++ //gtk_widget_show(fxmain->window);
++ /if(window_pos_x_old == 0 && window_pos_y_old == 0){
++ window_pos_x_old = window_pos_x;
++ window_pos_y_old = window_pos_y;
++ }
++ gtk_window_move(GTK_WINDOW(window),
++ window_pos_x_old , window_pos_y_old);/
++ gtk_window_present(GTK_WINDOW(window));
++ }
++}
++
++void messaging_menu_add_new_msg(HybridBuddy *buddy)
++{
++ gchar *sid = 0;
++ gchar count[128];
++
++ sid = buddy->id;
++
++ IndicateIndicator *indicator = get_indicator(indserver, sid);
++
++ gint count_int = atoi(indicate_indicator_get_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT));
++ snprintf(count, sizeof(count) - 1, "%d", count_int + 1);
++ indicate_indicator_set_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_COUNT, count);
++#if 0
++ GTimeVal time;
++ g_get_current_time(&time);
++ indicate_indicator_set_property_time(ind, "time", &time);
++#endif
++ indicate_indicator_set_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_NAME,
++ buddy->name && *buddy->name ? buddy->name : buddy->id);
++ indicate_indicator_set_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, "GET A MESSAGE");
++ //g_free(sid);
++}
++
++void clear_indicate_attention()
++{
++ GSList *iterator = NULL;
++ IndicateIndicator *indicator = NULL;
++ printf("clear indicat");
++ for (iterator = indicators; iterator; iterator = iterator->next) {
++ indicator = (IndicateIndicator)iterator->data;
++ /* clear attention /
++ indicate_indicator_set_property(indicator, INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION, "");
++ / remove the indicators from the indicate server /
++ indicate_server_remove_indicator(indserver, indicator);
++ }
++
++ / free the memory allocated for the indicator list */
++ g_slist_free(indicators);
++ indicators = NULL;
++}
++
++void binding_indicator(GtkWindow *window)
++{
++ printf("bingding");
++ IndicateServer *server = indicate_server_ref_default();
++ indicate_server_set_type(server, "message.hybrid");
++ indicate_server_set_desktop_file(server, DESKTOP_DIR"hybrid.desktop");
++ indicate_server_show(server);
++ indserver = server;
++ g_signal_connect(G_OBJECT(server), "server-display", G_CALLBACK(server_display), window);
++}
++#endif
diff --cc src/indicator.h
index 0000000,0000000..e554bf0
new file mode 100644
--- /dev/null
+++ b/src/indicator.h
@@@ -1,0 -1,0 +1,17 @@@
++#ifndef HYBRID_NOTIFY_H
++#define HYBRID_NOTIFY_H
++
++#include <gtk/gtk.h>
++#include "util.h"
++#include "blist.h"
++#include "conv.h"
++#include "head.h"
++#include "info.h"
++
++void binding_indicator(GtkWindow *window);
++
++void clear_indicate_attention();
++
++void messaging_menu_add_new_msg(HybridBuddy *buddy);
++
++#endif
我是 Ubuntu 11.10的环境
unity环境我这里没有,能支持最好,但肯定需要ubuntu用户的力量,你把这个patch放到你的分支里面我测试一下看在gnome2下有没有什么问题,另外最好稳定了之后发一个pull request过来吧
分支pull request 什么的我都不会弄,汗,而且我这个只是针对我的环境,通知机制可能你以后会加的,其实也是从以前你的openfetion里看的,参考吧。