grim/guifications2

bf693543cbae
Parents 18785adbd1d3
Children 7ee15787dd79
bringing gf_action up to speed for hidden structs
  • +37 -23
    src/gf_action.c
  • --- a/src/gf_action.c Sun Nov 28 03:14:55 2010 -0600
    +++ b/src/gf_action.c Sat Dec 03 23:16:33 2011 -0600
    @@ -289,29 +289,26 @@
    void
    gf_action_execute_open_conv(GfDisplay *display, GdkEventButton *gdk_event) {
    - GfEvent *event;
    GfEventInfo *info;
    PurpleAccount *account = NULL;
    PurpleBuddy *buddy = NULL;
    PurpleConversation *conv = NULL;
    const GHashTable *components = NULL;
    - const gchar *n_type, *target;
    + const gchar *target;
    g_return_if_fail(display);
    info = gf_display_get_event_info(display);
    - event = gf_event_info_get_event(info);
    - n_type = gf_event_get_notification_type(event);
    account = gf_event_info_get_account(info);
    buddy = gf_event_info_get_buddy(info);
    conv = gf_event_info_get_conversation(info);
    components = gf_event_info_get_components(info);
    target = gf_event_info_get_target(info);
    -
    +
    if(conv) { /* we have a conv */
    if(!conversation_exists(conv)) {
    - /* the conv we have doesn't exist anymore.. */
    + /* the conv we have doesn't exist anymore.. */
    const gchar *target;
    target = gf_event_info_get_target(info);
    @@ -376,29 +373,31 @@
    void
    gf_action_execute_log(GfDisplay *display, GdkEventButton *gdk_event) {
    - GfEvent *event;
    GfEventInfo *info;
    PurpleAccount *account;
    PurpleConversation *conv;
    - const gchar *n_type, *target;
    + const gchar *target;
    g_return_if_fail(display);
    info = gf_display_get_event_info(display);
    account = gf_event_info_get_account(info);
    - event = gf_event_info_get_event(info);
    conv = gf_event_info_get_conversation(info);
    target = gf_event_info_get_target(info);
    - n_type = gf_event_get_notification_type(event);
    -
    if(conv) {
    PurpleConversationType type;
    type = purple_conversation_get_type(conv);
    if(type == PURPLE_CONV_TYPE_IM || type == PURPLE_CONV_TYPE_CHAT) {
    - pidgin_log_show(type, (type == PURPLE_CONV_TYPE_IM) ? target : conv->name, account);
    + if(type == PURPLE_CONV_TYPE_IM) {
    + pidgin_log_show(type, target, account);
    + } else {
    + const gchar *name = purple_conversation_get_name(conv);
    + pidgin_log_show(type, name, account);
    + }
    +
    gf_display_destroy(display);
    }
    } else if(target) {
    @@ -535,6 +534,7 @@
    GfEventInfo *info = NULL;
    PurpleAccount *account = NULL;
    PurpleConversation *conv = NULL;
    + const gchar *name = NULL;
    info = gf_display_get_event_info(display);
    g_return_if_fail(info);
    @@ -545,7 +545,8 @@
    conv = gf_event_info_get_conversation(info);
    g_return_if_fail(conv);
    - pidgin_log_show(PURPLE_LOG_CHAT, conv->name, account);
    + name = purple_conversation_get_name(conv);
    + pidgin_log_show(PURPLE_LOG_CHAT, name, account);
    }
    static void
    @@ -568,6 +569,7 @@
    PurpleAccount *account = NULL;
    PurpleChat *chat = NULL;
    PurpleConversation *conv = NULL;
    + const gchar *name = NULL;
    info = gf_display_get_event_info(display);
    g_return_if_fail(info);
    @@ -578,7 +580,8 @@
    conv = gf_event_info_get_conversation(info);
    g_return_if_fail(conv);
    - chat = purple_blist_find_chat(account, conv->name);
    + name = purple_conversation_get_name(conv);
    + chat = purple_blist_find_chat(account, name);
    g_return_if_fail(chat);
    pidgin_dialogs_alias_chat(chat);
    @@ -607,6 +610,7 @@
    GfEventInfo *info = NULL;
    PurpleAccount *account = NULL;
    PurpleConversation *conv = NULL;
    + const gchar *name = NULL;
    info = gf_display_get_event_info(display);
    g_return_if_fail(info);
    @@ -617,7 +621,8 @@
    conv = gf_event_info_get_conversation(info);
    g_return_if_fail(conv);
    - purple_blist_request_add_chat(account, NULL, NULL, conv->name);
    + name = purple_conversation_get_name(conv);
    + purple_blist_request_add_chat(account, NULL, NULL, name);
    }
    static void
    @@ -640,6 +645,7 @@
    PurpleAccount *account = NULL;
    PurpleChat *chat = NULL;
    PurpleConversation *conv = NULL;
    + const gchar *name = NULL;
    info = gf_display_get_event_info(display);
    g_return_if_fail(info);
    @@ -650,7 +656,8 @@
    conv = gf_event_info_get_conversation(info);
    g_return_if_fail(conv);
    - chat = purple_blist_find_chat(account, conv->name);
    + name = purple_conversation_get_name(conv);
    + chat = purple_blist_find_chat(account, name);
    g_return_if_fail(chat);
    pidgin_dialogs_remove_chat(chat);
    @@ -680,6 +687,7 @@
    PurpleAccount *account = NULL;
    PurpleChat *chat = NULL;
    PurpleConversation *conv = NULL;
    + const gchar *name = NULL;
    info = gf_display_get_event_info(display);
    g_return_if_fail(info);
    @@ -690,7 +698,8 @@
    conv = gf_event_info_get_conversation(info);
    g_return_if_fail(conv);
    - chat = purple_blist_find_chat(account, conv->name);
    + name = purple_conversation_get_name(conv);
    + chat = purple_blist_find_chat(account, name);
    g_return_if_fail(chat);
    purple_blist_node_set_bool((PurpleBlistNode *)chat, "gtk-autojoin",
    @@ -707,10 +716,11 @@
    PurpleBuddy *buddy = NULL;
    PurpleChat *chat = NULL;
    PurpleConversation *conv = NULL;
    + PurpleConversationType type = 0;
    PurplePlugin *prpl = NULL;
    PurplePluginProtocolInfo *prpl_info = NULL;
    GtkWidget *menu;
    - const gchar *target = NULL;
    + const gchar *target = NULL, *name = NULL;
    gboolean chat_sep_added = FALSE;
    guint timeout_id;
    @@ -735,8 +745,13 @@
    conv = gf_event_info_get_conversation(info);
    target = gf_event_info_get_target(info);
    + if(conv) {
    + type = purple_conversation_get_type(conv);
    + name = purple_conversation_get_name(conv);
    + }
    +
    if(conv)
    - chat = purple_blist_find_chat(account, conv->name);
    + chat = purple_blist_find_chat(account, name);
    /* find the prpl and it's info */
    prpl = purple_find_prpl(purple_account_get_protocol_id(account));
    @@ -776,7 +791,7 @@
    if(!buddy && target)
    buddy = purple_find_buddy(account, target);
    -
    +
    if(buddy) {
    pidgin_new_item_from_stock(menu, _("View IM log"), NULL,
    G_CALLBACK(gf_action_context_log_buddy_cb),
    @@ -832,14 +847,13 @@
    G_CALLBACK(gf_action_context_autojoin_cb),
    display, checked);
    -
    }
    /* if we have a conversation and it's a chat, we show the view log for it.
    * if we don't do this check we end up with two menu items to view the
    * same log..
    */
    - if(conv && conv->type == PURPLE_CONV_TYPE_CHAT) {
    + if(conv && type == PURPLE_CONV_TYPE_CHAT) {
    if(!chat_sep_added) {
    pidgin_separator(menu);
    chat_sep_added = TRUE;
    @@ -869,7 +883,7 @@
    }
    /* add the add chat item if it's not on our blist.. */
    - if(!chat && conv && conv->type == PURPLE_CONV_TYPE_CHAT) {
    + if(!chat && conv && type == PURPLE_CONV_TYPE_CHAT) {
    pidgin_new_item_from_stock(menu, _("Add Chat"), GTK_STOCK_ADD,
    G_CALLBACK(gf_action_context_add_chat_cb),
    display, 0, 0, NULL);