Example #1
0
static gboolean
plugin_load(PurplePlugin *plugin)
{
	purple_signal_connect(purple_conversations_get_handle(),
						"conversation-created",
						plugin, PURPLE_CALLBACK(historize), NULL);

	purple_prefs_connect_callback(plugin, "/purple/logging/log_ims",
								history_prefs_cb, plugin);
	purple_prefs_connect_callback(plugin, "/purple/logging/log_chats",
								history_prefs_cb, plugin);

	history_prefs_check(plugin);

	return TRUE;
}
Example #2
0
guint
purple_perl_prefs_connect_callback(PurplePlugin *plugin, const char *name,
								   SV *callback, SV *data)
{
	PurplePerlPrefsHandler *handler;

	if (plugin == NULL) {
		croak("Invalid handle in adding perl prefs handler.\n");
		return 0;
	}

	handler = g_new0(PurplePerlPrefsHandler, 1);

	handler->plugin   = plugin;
	handler->callback = (callback != NULL && callback != &PL_sv_undef
	                     ? newSVsv(callback) : NULL);
	handler->data     = (data != NULL && data != &PL_sv_undef
	                     ? newSVsv(data) : NULL);

	pref_handlers = g_slist_prepend(pref_handlers, handler);

	handler->iotag = purple_prefs_connect_callback(plugin, name, perl_pref_cb, handler);

	return handler->iotag;
}
Example #3
0
void
purple_prefs_init(void)
{
	void *handle = purple_prefs_get_handle();

	prefs_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);

	purple_prefs_connect_callback(handle, "/", prefs_save_cb, NULL);

	purple_prefs_add_none("/purple");
	purple_prefs_add_none("/plugins");
	purple_prefs_add_none("/plugins/core");
	purple_prefs_add_none("/plugins/lopl");
	purple_prefs_add_none("/plugins/prpl");

	/* Away */
	purple_prefs_add_none("/purple/away");
	purple_prefs_add_string("/purple/away/idle_reporting", "system");
	purple_prefs_add_bool("/purple/away/away_when_idle", TRUE);
	purple_prefs_add_int("/purple/away/mins_before_away", 5);

	/* Away -> Auto-Reply */
	if (!purple_prefs_exists("/purple/away/auto_response/enabled") ||
	    !purple_prefs_exists("/purple/away/auto_response/idle_only"))
	{
		purple_prefs_add_string("/purple/away/auto_reply", "awayidle");
	}
	else
	{
		if (!purple_prefs_get_bool("/purple/away/auto_response/enabled"))
		{
			purple_prefs_add_string("/purple/away/auto_reply", "never");
		}
		else
		{
			if (purple_prefs_get_bool("/purple/away/auto_response/idle_only"))
			{
				purple_prefs_add_string("/purple/away/auto_reply", "awayidle");
			}
			else
			{
				purple_prefs_add_string("/purple/away/auto_reply", "away");
			}
		}
	}

	/* Buddies */
	purple_prefs_add_none("/purple/buddies");

	/* Contact Priority Settings */
	purple_prefs_add_none("/purple/contact");
	purple_prefs_add_bool("/purple/contact/last_match", FALSE);
	purple_prefs_remove("/purple/contact/offline_score");
	purple_prefs_remove("/purple/contact/away_score");
	purple_prefs_remove("/purple/contact/idle_score");

	purple_prefs_load();
	purple_prefs_update_old();
}
Example #4
0
static gboolean plugin_load(PurplePlugin *plugin, GError **error) {
	purple_prefs_add_none("/plugins/gtk");
	purple_prefs_add_none("/plugins/gtk/win32");
	purple_prefs_add_none("/plugins/gtk/win32/winprefs");
	purple_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE);
	purple_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE);
	purple_prefs_add_int(PREF_DBLIST_HEIGHT, 0);
	purple_prefs_add_int(PREF_DBLIST_SIDE, 0);

	/* Convert old preferences */
	if(purple_prefs_exists(PREF_DBLIST_ON_TOP)) {
		gint blist_top = BLIST_TOP_NEVER;
		if(purple_prefs_get_bool(PREF_BLIST_ON_TOP))
			blist_top = BLIST_TOP_ALWAYS;
		else if(purple_prefs_get_bool(PREF_DBLIST_ON_TOP))
			blist_top = BLIST_TOP_DOCKED;
		purple_prefs_remove(PREF_BLIST_ON_TOP);
		purple_prefs_remove(PREF_DBLIST_ON_TOP);
		purple_prefs_add_int(PREF_BLIST_ON_TOP, blist_top);
	} else
		purple_prefs_add_int(PREF_BLIST_ON_TOP, BLIST_TOP_NEVER);
	purple_prefs_remove(PREF_CHAT_BLINK);

	handle = plugin;

	/* blist docking init */
	if(purple_blist_get_buddy_list() && PIDGIN_BLIST(purple_blist_get_buddy_list())
			&& PIDGIN_BLIST(purple_blist_get_buddy_list())->window) {
		blist_create_cb(purple_blist_get_buddy_list(), NULL);
	}

	/* This really shouldn't happen anymore generally, but if for some strange
	   reason, the blist is recreated, we need to set it up again. */
	purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created",
		plugin, PURPLE_CALLBACK(blist_create_cb), NULL);

	purple_signal_connect((void*)purple_get_core(), "quitting", plugin,
		PURPLE_CALLBACK(purple_quit_cb), NULL);

	purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP,
		winprefs_set_blist_ontop, NULL);
	purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE,
		winprefs_set_blist_dockable, NULL);

	return TRUE;
}
Example #5
0
static void
purple_keyring_pref_connect(void)
{
    g_return_if_fail(purple_keyring_pref_cbid == 0);

    purple_keyring_pref_cbid = purple_prefs_connect_callback(NULL,
                               "/purple/keyring/active", purple_keyring_pref_callback, NULL);
}
Example #6
0
BuddyList::BuddyList()
: Window(0, 0, 80, 24)
{
  SetColorScheme("buddylist");

  CppConsUI::HorizontalListBox *lbox
    = new CppConsUI::HorizontalListBox(AUTOSIZE, AUTOSIZE);
  lbox->AppendWidget(*(new CppConsUI::Spacer(1, AUTOSIZE)));
  treeview = new CppConsUI::TreeView(AUTOSIZE, AUTOSIZE);
  lbox->AppendWidget(*treeview);
  lbox->AppendWidget(*(new CppConsUI::Spacer(1, AUTOSIZE)));
  AddWidget(*lbox, 0, 0);

  /* TODO Check if this has been moved to purple_blist_init(). Remove these
   * lines if it was as this will probably move to purple_init(), the
   * buddylist object should be available a lot more early and the uiops
   * should be set a lot more early. (All in all a lot of work.) */
  buddylist = purple_blist_new();
  buddylist->ui_data = this;
  purple_set_blist(buddylist);

  // load the pounces
  purple_pounces_load();

  // init prefs
  purple_prefs_add_none(CONF_PREFIX "/blist");
  purple_prefs_add_bool(CONF_PREFIX "/blist/show_empty_groups", false);
  purple_prefs_add_bool(CONF_PREFIX "/blist/show_offline_buddies", true);
  purple_prefs_add_string(CONF_PREFIX "/blist/colorization_mode", "none");

  UpdateCachedPreference(CONF_PREFIX "/blist/show_empty_groups");
  UpdateCachedPreference(CONF_PREFIX "/blist/show_offline_buddies");
  UpdateCachedPreference(CONF_PREFIX "/blist/colorization_mode");

  // connect callbacks
  purple_prefs_connect_callback(this, CONF_PREFIX "/blist",
      blist_pref_change_, this);

  // setup the callbacks for the buddylist
  memset(&centerim_blist_ui_ops, 0, sizeof(centerim_blist_ui_ops));
  centerim_blist_ui_ops.new_list = new_list_;
  centerim_blist_ui_ops.new_node = new_node_;
  //centerim_blist_ui_ops.show = show_;
  centerim_blist_ui_ops.update = update_;
  centerim_blist_ui_ops.remove = remove_;
  centerim_blist_ui_ops.destroy = destroy_;
  //centerim_blist_ui_ops.set_visible = set_visible_;
  centerim_blist_ui_ops.request_add_buddy = request_add_buddy_;
  centerim_blist_ui_ops.request_add_chat = request_add_chat_;
  centerim_blist_ui_ops.request_add_group = request_add_group_;
  // since libpurple 2.6.0
  //centerim_blist_ui_ops.save_node = save_node_;
  //centerim_blist_ui_ops.remove_node = remove_node_;
  //centerim_blist_ui_ops.save_account = save_account_;
  purple_blist_set_ui_ops(&centerim_blist_ui_ops);

  COREMANAGER->TimeoutOnceConnect(sigc::mem_fun(this, &BuddyList::Load), 0);
}
Example #7
0
/* This needs to be delayed otherwise, when the blist is originally created and
 * hidden, it'll trigger the blist_visible_cb */
static gboolean listen_for_blist_visible_cb(gpointer data) {
	if (handle != NULL)
		blist_visible_cb_id =
			purple_prefs_connect_callback(handle,
				PIDGIN_PREFS_ROOT "/blist/list_visible",
				blist_visible_cb, NULL);

	return FALSE;
}
Example #8
0
static void
init_plugin(PurplePlugin *plugin)
{
	purple_prefs_add_none("/plugins/gtk");
	purple_prefs_add_none("/plugins/gtk/X11");
	purple_prefs_add_none("/plugins/gtk/X11/gestures");
	purple_prefs_add_bool("/plugins/gtk/X11/gestures/visual", FALSE);

	purple_prefs_connect_callback(plugin, "/plugins/gtk/X11/gestures/visual",
								visual_pref_cb, NULL);
}
Example #9
0
static gboolean
purplerc_plugin_load(PurplePlugin *plugin)
{
	purplerc_make_changes();

	pref_callback = purple_prefs_connect_callback(plugin,
	                                              "/plugins/gtk/purplerc",
	                                              purplerc_pref_changed_cb,
	                                              NULL);

	return TRUE;
}
Example #10
0
void ap_gtk_start () {
  progress_bars = g_hash_table_new (NULL, NULL);
        
  // Message queueing 
  queue_pref_cb = purple_prefs_connect_callback (
    ap_get_plugin_handle (), 
    "/plugins/gtk/autoprofile/queue_messages_when_away", queue_cb, NULL);

  // Create window
  create_dialog ();
  update_summary_visibility ();
}
Example #11
0
GtkWidget *ap_prefs_labeled_entry (struct widget *w, GtkWidget *page, 
  const gchar *title, const char *key, GtkSizeGroup *sg) {
  GtkWidget *result; 
  const gchar *pref;

  pref = get_const_pref (w, key);
  result = pidgin_prefs_labeled_entry (page, title, pref, sg);
  purple_prefs_connect_callback (ap_get_plugin_handle (), pref,
    pref_callback, w);

  return result;
}
Example #12
0
GtkWidget *ap_prefs_checkbox (struct widget *w, const char *title, 
  const char *key, GtkWidget *page) 
{
  GtkWidget *result;
  const gchar *pref;

  pref = get_const_pref (w, key);
  result = pidgin_prefs_checkbox (title, pref, page);
  purple_prefs_connect_callback (ap_get_plugin_handle (), pref,
    pref_callback, w);

  return result;
}
Example #13
0
static void
pidgin_mini_dialog_init(PidginMiniDialog *self)
{
	GtkBox *self_box = GTK_BOX(self);
	guint blist_width = purple_prefs_get_int(BLIST_WIDTH_PREF);
	guint label_width = blist_width - BLIST_WIDTH_OTHER_THAN_LABEL;

	PidginMiniDialogPrivate *priv = g_new0(PidginMiniDialogPrivate, 1);
	self->priv = priv;

	gtk_container_set_border_width(GTK_CONTAINER(self), PIDGIN_HIG_BOX_SPACE);

	priv->title_box = GTK_BOX(gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE));

	priv->icon = GTK_IMAGE(gtk_image_new());
	gtk_misc_set_alignment(GTK_MISC(priv->icon), 0, 0);

	priv->title = GTK_LABEL(gtk_label_new(NULL));
	gtk_widget_set_size_request(GTK_WIDGET(priv->title), label_width, -1);
	gtk_label_set_line_wrap(priv->title, TRUE);
	gtk_label_set_selectable(priv->title, TRUE);
	gtk_misc_set_alignment(GTK_MISC(priv->title), 0, 0);

	gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->icon), FALSE, FALSE, 0);
	gtk_box_pack_start(priv->title_box, GTK_WIDGET(priv->title), TRUE, TRUE, 0);

	priv->desc = GTK_LABEL(gtk_label_new(NULL));
	gtk_widget_set_size_request(GTK_WIDGET(priv->desc), label_width, -1);
	gtk_label_set_line_wrap(priv->desc, TRUE);
	gtk_misc_set_alignment(GTK_MISC(priv->desc), 0, 0);
	gtk_label_set_selectable(priv->desc, TRUE);
	/* make calling show_all() on the minidialog not affect desc even though
	 * it's packed inside it.
	 */
	g_object_set(G_OBJECT(priv->desc), "no-show-all", TRUE, NULL);

	purple_prefs_connect_callback(self, BLIST_WIDTH_PREF,
		blist_width_changed_cb, self);

	self->contents = GTK_BOX(gtk_vbox_new(FALSE, 0));

	priv->buttons = GTK_BOX(gtk_hbox_new(FALSE, 0));

	gtk_box_pack_start(self_box, GTK_WIDGET(priv->title_box), FALSE, FALSE, 0);
	gtk_box_pack_start(self_box, GTK_WIDGET(priv->desc), FALSE, FALSE, 0);
	gtk_box_pack_start(self_box, GTK_WIDGET(self->contents), TRUE, TRUE, 0);
	gtk_box_pack_start(self_box, GTK_WIDGET(priv->buttons), FALSE, FALSE, 0);

	gtk_widget_show_all(GTK_WIDGET(self));
}
Example #14
0
GtkWidget *ap_prefs_dropdown_from_list (struct widget *w, GtkWidget *page,
  const gchar *title, PurplePrefType type, const char *key, GList *menuitems) 
{
  GtkWidget *result;
  const gchar *pref;

  pref = get_const_pref (w, key);
  result = pidgin_prefs_dropdown_from_list (
    page, title, type, pref, menuitems);
  purple_prefs_connect_callback (ap_get_plugin_handle (), pref,
    pref_callback, w);

  return result;
}
Example #15
0
static gboolean plugin_load(PurplePlugin *plugin) {
	handle = plugin;

	/* blist docking init */
	if(purple_get_blist() && PIDGIN_BLIST(purple_get_blist())
			&& PIDGIN_BLIST(purple_get_blist())->window) {
		blist_create_cb(purple_get_blist(), NULL);
	}

	/* This really shouldn't happen anymore generally, but if for some strange
	   reason, the blist is recreated, we need to set it up again. */
	purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created",
		plugin, PURPLE_CALLBACK(blist_create_cb), NULL);

	purple_signal_connect((void*)purple_get_core(), "quitting", plugin,
		PURPLE_CALLBACK(purple_quit_cb), NULL);

	purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP,
		winprefs_set_blist_ontop, NULL);
	purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE,
		winprefs_set_blist_dockable, NULL);

	return TRUE;
}
Example #16
0
/**
 * The plugin's load function
 *
 * @param[in] plugin     Pointer to the plugin
 * @return               Whether to continue loading
**/
static gboolean plugin_load(PurplePlugin *plugin)
{
	PidginBuddyList *
	    gtkblist;	  /*< For determining if blist was initialized */
	void *conv_handle;     /*< The conversations handle                 */
	void *gtkblist_handle; /*< The Pidgin Buddy List handle             */
	void *gtkconv_handle;  /*< The Pidgin conversations handle          */

	/* XXX: There should be an interface to list available Buddy List
	 * windows. */
	gtkblist = pidgin_blist_get_default_gtk_blist();
	conv_handle = purple_conversations_get_handle();
	gtkblist_handle = pidgin_blist_get_handle();
	gtkconv_handle = pidgin_conversations_get_handle();

	/* Add the conversation placement option provided by this plugin. */
	pidgin_conv_placement_add_fnc(PLUGIN_TOKEN, _(PWM_STR_CP_BLIST),
				      &conv_placement_by_blist);
	purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT
				      "/conversations/placement");

	/* Rebuild the layout when the preference changes. */
	purple_prefs_connect_callback(plugin, PREF_SIDE, pref_convs_side_cb,
				      NULL);

	/* Toggle the instruction panel as conversations come and go. */
	purple_signal_connect(conv_handle, "conversation-created", plugin,
			      PURPLE_CALLBACK(conversation_created_cb), NULL);
	purple_signal_connect(conv_handle, "deleting-conversation", plugin,
			      PURPLE_CALLBACK(deleting_conversation_cb), NULL);
	purple_signal_connect(gtkconv_handle, "conversation-dragging", plugin,
			      PURPLE_CALLBACK(conversation_dragging_cb), NULL);
	purple_signal_connect(gtkconv_handle, "conversation-hiding", plugin,
			      PURPLE_CALLBACK(conversation_hiding_cb), NULL);
	purple_signal_connect(gtkconv_handle, "conversation-switched", plugin,
			      PURPLE_CALLBACK(conversation_switched_cb), NULL);

	/* Hijack Buddy Lists as they are created. */
	purple_signal_connect(gtkblist_handle, "gtkblist-created", plugin,
			      PURPLE_CALLBACK(gtkblist_created_cb), NULL);

	/* If a default Buddy List is already available, use it immediately. */
	if (gtkblist != NULL && gtkblist->window != NULL)
		pwm_merge_conversation(gtkblist);

	return TRUE;
}
static gboolean
plugin_load (PurplePlugin * plugin)
{

  trace("plugin loading");

  recent_contacts_plugin = plugin; /* assign this here so we have a
                                      valid handle later */
  g_size = purple_prefs_get_int(PREF_SIZE);
  void *handle = purple_prefs_get_handle();
  purple_prefs_connect_callback(handle, PREF_SIZE, pref_size_on_change, NULL);
  void *conv_handle = purple_conversations_get_handle();
  purple_signal_connect(conv_handle, "conversation-created", plugin,
  		PURPLE_CALLBACK(rc_at_conversation_event), NULL);
  purple_signal_connect(conv_handle, "deleting-conversation", plugin, 
  		PURPLE_CALLBACK(rc_at_conversation_event), NULL);
  return TRUE;
}
Example #18
0
static gboolean
plugin_load (PurplePlugin *plugin)
{
	void *conv_handle, *blist_handle, *conn_handle;

	construct_list();

	if (!notify_is_initted () && !notify_init ("Pidgin")) {
		purple_debug_error (PLUGIN_ID, "libnotify not running!\n");
		return FALSE;
	}

	conv_handle = purple_conversations_get_handle ();
	blist_handle = purple_blist_get_handle ();
	conn_handle = purple_connections_get_handle();

	buddy_hash = g_hash_table_new (NULL, NULL);

	purple_signal_connect (blist_handle, "buddy-signed-on", plugin,
						PURPLE_CALLBACK(notify_buddy_signon_cb), NULL);

	purple_signal_connect (blist_handle, "buddy-signed-off", plugin,
						PURPLE_CALLBACK(notify_buddy_signoff_cb), NULL);

	purple_signal_connect (conv_handle, "received-im-msg", plugin,
						PURPLE_CALLBACK(notify_new_message_cb), NULL);

	purple_signal_connect (conv_handle, "received-chat-msg", plugin,
						PURPLE_CALLBACK(notify_chat_nick), NULL);

	purple_signal_connect (conv_handle, "deleting-conversation", plugin,
						PURPLE_CALLBACK(notify_deleting_conversation_cb), NULL);

	purple_prefs_connect_callback(plugin, "/plugins/gtk/libnotify/triggerMessages",
					(PurplePrefCallback)construct_list, NULL);

	/* used just to not display the flood of guifications we'd get */
	purple_signal_connect (conn_handle, "signed-on", plugin,
						PURPLE_CALLBACK(event_connection_throttle), NULL);

	return TRUE;
}
Example #19
0
/*  Initialize the plugin preferences.
 *  Create the root preference directory if needed.
 *  If the aliases preference exists, load it;
 *  otherwise, initialize it from the default aliases value.
 *  Then call the aliases_changed_cb function to build the aliases_list.
 */
static void
init_prefs(PurplePlugin *plugin) {
    const char *aliases ;
    /*  If the root preference directory does not exist, create it  */
    if (!purple_prefs_exists(PREFS_ROOT)) {
        purple_prefs_add_none(PREFS_ROOT) ;
    }
    /*  If the alias preference exists, load it, otherwise create it from the default value  */
    if (purple_prefs_exists(PREFS_ALIASES)) {
        aliases = purple_prefs_get_string(PREFS_ALIASES) ;
    } else {
        purple_prefs_add_string(PREFS_ALIASES, DEFAULT_ALIASES) ;
        aliases = DEFAULT_ALIASES ;
    }
    /*  initialize the alias list from the alias value loaded (or created)  */
    aliases_changed_cb(PREFS_ALIASES, PURPLE_PREF_STRING, aliases, NULL) ;
    /*  connect aliases_changed_cb to be called whenever the preference
     *  changes
     */
    purple_prefs_connect_callback(plugin, PREFS_ALIASES, (PurplePrefCallback)(&aliases_changed_cb), NULL) ;
    /*  Done, nothing to return  */
    return ;
}
Example #20
0
static void
get_plugin_frame(GtkWidget *parent, GtkSizeGroup *sg,
		const gchar *name, const gchar *plugin_label,
		const gchar **plugin_strs, const gchar *plugin_pref,
		const gchar *device_label, const gchar *device_pref)
{
	GtkWidget *vbox, *widget;
	GList *plugins, *devices;

	vbox = pidgin_make_frame(parent, name);

	/* Setup plugin preference */
	plugins = get_element_plugins(plugin_strs);
	widget = pidgin_prefs_dropdown_from_list(vbox, plugin_label,
			PURPLE_PREF_STRING, plugin_pref, plugins);
	g_list_free(plugins);
	gtk_size_group_add_widget(sg, widget);
	gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);

	/* Setup device preference */
	devices = get_element_devices(purple_prefs_get_string(plugin_pref));
	if (g_list_find_custom(devices, purple_prefs_get_string(device_pref),
			(GCompareFunc) strcmp) == NULL)
		purple_prefs_set_string(device_pref, g_list_next(devices)->data);
	widget = pidgin_prefs_dropdown_from_list(vbox, device_label,
			PURPLE_PREF_STRING, device_pref, devices);
	g_list_free(devices);
	gtk_widget_set_name(widget, plugin_pref);
	gtk_size_group_add_widget(sg, widget);
	gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);

	purple_prefs_connect_callback(vbox, plugin_pref,
			device_changed_cb, sg);
	g_signal_connect_swapped(vbox, "destroy",
			G_CALLBACK(purple_prefs_disconnect_by_handle), vbox);
}
Example #21
0
/*--------------------------------------------------------------------------*
 * Create the main window                                                   *
 *--------------------------------------------------------------------------*/
static void create_dialog () {
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;
  GtkTreeSelection *selection;
  GtkWidget *message_list_view;
  
  GtkWidget *vbox, *vpane, *hbox, *config_vbox;
  GtkWidget *sw, *imhtml, *msg_window, *button;

  imhtml = gtk_imhtml_new (NULL, NULL);
  
  /* Create main display window */
  dialog = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_type_hint (GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_window_set_title (GTK_WINDOW(dialog), _("AutoProfile Summary"));
  gtk_widget_realize (dialog);

  vbox = gtk_vbox_new (FALSE, 5);
  gtk_container_add (GTK_CONTAINER (dialog), vbox);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);

  /* Set up progress bar container */
  progress_create (AP_UPDATE_PROFILE, vbox);
  progress_create (AP_UPDATE_STATUS, vbox);

  /* Set up list of past away messages */
  vpane = gtk_vpaned_new ();
  gtk_box_pack_start (GTK_BOX(vbox), vpane, TRUE, TRUE, 0);
  
  message_list = gtk_list_store_new (4, 
    G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
  message_list_view = gtk_tree_view_new_with_model (
    GTK_TREE_MODEL (message_list));
  renderer = gtk_cell_renderer_text_new ();

  column = gtk_tree_view_column_new_with_attributes (
    _("Time"), renderer, "markup", 0, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (message_list_view), column);
  gtk_tree_view_column_set_sort_column_id (column, 0);

  column = gtk_tree_view_column_new_with_attributes (
    _("Type"), renderer, "markup", 1, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (message_list_view), column);
  gtk_tree_view_column_set_sort_column_id (column, 1);

  renderer = gtk_cell_renderer_text_new ();
  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);

  column = gtk_tree_view_column_new_with_attributes (
    _("Text"), renderer, "markup", 2, NULL);
  gtk_tree_view_append_column (GTK_TREE_VIEW (message_list_view), column);
  gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);

  sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), 
    GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), 
    GTK_SHADOW_IN);

  gtk_container_add (GTK_CONTAINER (sw), message_list_view);
  gtk_paned_add1 (GTK_PANED(vpane), sw);
 
  selection = gtk_tree_view_get_selection (
    GTK_TREE_VIEW (message_list_view));
  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
  g_signal_connect (G_OBJECT (selection), "changed",
                    G_CALLBACK (display_diff_msg), imhtml);

  /* Set up the window to display away message in */
  msg_window = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(msg_window), 
    GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(msg_window), 
    GTK_SHADOW_IN);
  gtk_paned_add2 (GTK_PANED(vpane), msg_window);
 
  gtk_container_add (GTK_CONTAINER(msg_window), imhtml);
  pidgin_setup_imhtml (imhtml);
 
  /* Bottom area */
  hbox = gtk_hbox_new (FALSE, 6);
  gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

  config_vbox = gtk_vbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX(hbox), config_vbox, TRUE, TRUE, 0);
 
  pidgin_prefs_checkbox (
    _("Queue new messages while away"),
    "/plugins/gtk/autoprofile/queue_messages_when_away", 
    config_vbox);

  button = pidgin_prefs_checkbox (
    _("Play sounds while away"),
    "/purple/sound/while_away",
    config_vbox);
  sound_pref_cb = purple_prefs_connect_callback (ap_get_plugin_handle (), 
    "/purple/sound/while_away", sound_cb, button);

  gtk_box_pack_start (GTK_BOX(hbox), gtk_vseparator_new (), FALSE, FALSE, 0);

  config_vbox = gtk_vbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX(hbox), config_vbox, TRUE, TRUE, 0);
  
  ap_gtk_prefs_add_summary_option (config_vbox);

  button = gtk_button_new_with_label (_("Hide summary now"));  
  gtk_box_pack_start (GTK_BOX(config_vbox), button, FALSE, FALSE, 0);
  g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (hide_cb), NULL);

  /* Finish up */
  g_signal_connect (G_OBJECT(dialog), "delete-event",
    G_CALLBACK(gtk_widget_hide_on_delete), NULL);
  gtk_paned_set_position (GTK_PANED(vpane), 250);
  gtk_window_set_default_size (GTK_WINDOW(dialog), 430, 430);
}
Example #22
0
static void
finch_sound_init(void)
{
	void *gnt_sound_handle = finch_sound_get_handle();
	void *blist_handle = purple_blist_get_handle();
	void *conv_handle = purple_conversations_get_handle();
#ifdef USE_GSTREAMER
	GError *error = NULL;
#endif

	purple_signal_connect(purple_connections_get_handle(), "signed-on",
						gnt_sound_handle, PURPLE_CALLBACK(account_signon_cb),
						NULL);

	purple_prefs_add_none(FINCH_PREFS_ROOT "/sound");
	purple_prefs_add_string(FINCH_PREFS_ROOT "/sound/actprofile", DEFAULT_PROFILE);
	purple_prefs_add_none(FINCH_PREFS_ROOT "/sound/profiles");

	purple_prefs_connect_callback(gnt_sound_handle, FINCH_PREFS_ROOT "/sound/actprofile", initialize_profile, NULL);
	purple_prefs_trigger_callback(FINCH_PREFS_ROOT "/sound/actprofile");


#ifdef USE_GSTREAMER
	purple_debug_info("sound", "Initializing sound output drivers.\n");
#if (GST_VERSION_MAJOR > 0 || \
	(GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \
	 (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 10))
	gst_registry_fork_set_enabled(FALSE);
#endif
	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
		purple_notify_error(NULL, _("GStreamer Failure"),
					_("GStreamer failed to initialize."),
					error ? error->message : "");
		if (error) {
			g_error_free(error);
			error = NULL;
		}
	}
#endif /* USE_GSTREAMER */

	purple_signal_connect(blist_handle, "buddy-signed-on",
						gnt_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
						GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE));
	purple_signal_connect(blist_handle, "buddy-signed-off",
						gnt_sound_handle, PURPLE_CALLBACK(buddy_state_cb),
						GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE));
	purple_signal_connect(conv_handle, "received-im-msg",
						gnt_sound_handle, PURPLE_CALLBACK(im_msg_received_cb),
						GINT_TO_POINTER(PURPLE_SOUND_RECEIVE));
	purple_signal_connect(conv_handle, "sent-im-msg",
						gnt_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb),
						GINT_TO_POINTER(PURPLE_SOUND_SEND));
	purple_signal_connect(conv_handle, "chat-buddy-joined",
						gnt_sound_handle, PURPLE_CALLBACK(chat_buddy_join_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN));
	purple_signal_connect(conv_handle, "chat-buddy-left",
						gnt_sound_handle, PURPLE_CALLBACK(chat_buddy_left_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE));
	purple_signal_connect(conv_handle, "sent-chat-msg",
						gnt_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY));
	purple_signal_connect(conv_handle, "received-chat-msg",
						gnt_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
						GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
	purple_signal_connect(conv_handle, "got-attention",
						gnt_sound_handle, PURPLE_CALLBACK(got_attention_cb),
						GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION));

	update_profiles();
}