pidgin/plugins/notify.c

branch
soc.2013.gobjectification.plugins
changeset 36757
2e04586cf6e8
parent 34678
40a30f74a7b8
child 36926
d2c0c68a9816
equal deleted inserted replaced
36756:1bcc14114857 36757:2e04586cf6e8
831 831
832 gtk_widget_show_all(ret); 832 gtk_widget_show_all(ret);
833 return ret; 833 return ret;
834 } 834 }
835 835
836 static PidginPluginInfo *
837 plugin_query(GError **error)
838 {
839 const gchar * const authors[] = {
840 "Etan Reisner <deryni@eden.rutgers.edu>",
841 "Brian Tarricone <bjt23@cornell.edu>",
842 NULL
843 };
844
845 return pidgin_plugin_info_new(
846 "id", NOTIFY_PLUGIN_ID,
847 "name", N_("Message Notification"),
848 "version", DISPLAY_VERSION,
849 "category", N_("Notification"),
850 "summary", N_("Provides a variety of ways of notifying "
851 "you of unread messages."),
852 "description", N_("Provides a variety of ways of notifying "
853 "you of unread messages."),
854 "authors", authors,
855 "website", PURPLE_WEBSITE,
856 "abi-version", PURPLE_ABI_VERSION,
857 "pidgin-config-frame", get_config_frame,
858 NULL
859 );
860 }
861
836 static gboolean 862 static gboolean
837 plugin_load(PurplePlugin *plugin) 863 plugin_load(PurplePlugin *plugin, GError **error)
838 { 864 {
839 GList *convs = purple_conversations_get_all(); 865 GList *convs = purple_conversations_get_all();
840 void *conv_handle = purple_conversations_get_handle(); 866 void *conv_handle = purple_conversations_get_handle();
841 void *gtk_conv_handle = pidgin_conversations_get_handle(); 867 void *gtk_conv_handle = pidgin_conversations_get_handle();
842 868
843 my_plugin = plugin; 869 my_plugin = plugin;
870
871 purple_prefs_add_none("/plugins/gtk");
872 purple_prefs_add_none("/plugins/gtk/X11");
873 purple_prefs_add_none("/plugins/gtk/X11/notify");
874
875 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE);
876 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE);
877 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_nick", FALSE);
878 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE);
879 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE);
880 purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)");
881 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE);
882 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE);
883 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE);
884 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE);
885 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_present", FALSE);
886 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE);
887 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE);
888 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE);
889 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE);
890 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE);
844 891
845 purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin, 892 purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin,
846 PURPLE_CALLBACK(message_displayed_cb), NULL); 893 PURPLE_CALLBACK(message_displayed_cb), NULL);
847 purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin, 894 purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin,
848 PURPLE_CALLBACK(message_displayed_cb), NULL); 895 PURPLE_CALLBACK(message_displayed_cb), NULL);
872 919
873 return TRUE; 920 return TRUE;
874 } 921 }
875 922
876 static gboolean 923 static gboolean
877 plugin_unload(PurplePlugin *plugin) 924 plugin_unload(PurplePlugin *plugin, GError **error)
878 { 925 {
879 GList *convs = purple_conversations_get_all(); 926 GList *convs = purple_conversations_get_all();
880 927
881 while (convs) { 928 while (convs) {
882 PurpleConversation *conv = (PurpleConversation *)convs->data; 929 PurpleConversation *conv = (PurpleConversation *)convs->data;
888 } 935 }
889 936
890 return TRUE; 937 return TRUE;
891 } 938 }
892 939
893 static PidginPluginUiInfo ui_info = 940 PURPLE_PLUGIN_INIT(notify, plugin_query, plugin_load, plugin_unload);
894 {
895 get_config_frame,
896 0, /* page_num (Reserved) */
897
898 /* padding */
899 NULL,
900 NULL,
901 NULL,
902 NULL
903 };
904
905 static PurplePluginInfo info =
906 {
907 PURPLE_PLUGIN_MAGIC,
908 PURPLE_MAJOR_VERSION,
909 PURPLE_MINOR_VERSION,
910 PURPLE_PLUGIN_STANDARD, /**< type */
911 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
912 0, /**< flags */
913 NULL, /**< dependencies */
914 PURPLE_PRIORITY_DEFAULT, /**< priority */
915
916 NOTIFY_PLUGIN_ID, /**< id */
917 N_("Message Notification"), /**< name */
918 DISPLAY_VERSION, /**< version */
919 /** summary */
920 N_("Provides a variety of ways of notifying you of unread messages."),
921 /** description */
922 N_("Provides a variety of ways of notifying you of unread messages."),
923 /**< author */
924 "Etan Reisner <deryni@eden.rutgers.edu>,\nBrian Tarricone <bjt23@cornell.edu>",
925 PURPLE_WEBSITE, /**< homepage */
926
927 plugin_load, /**< load */
928 plugin_unload, /**< unload */
929 NULL, /**< destroy */
930
931 &ui_info, /**< ui_info */
932 NULL, /**< extra_info */
933 NULL,
934 NULL,
935
936 /* padding */
937 NULL,
938 NULL,
939 NULL,
940 NULL
941 };
942
943 static void
944 init_plugin(PurplePlugin *plugin)
945 {
946 purple_prefs_add_none("/plugins/gtk");
947 purple_prefs_add_none("/plugins/gtk/X11");
948 purple_prefs_add_none("/plugins/gtk/X11/notify");
949
950 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE);
951 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE);
952 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_nick", FALSE);
953 purple_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE);
954 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE);
955 purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)");
956 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE);
957 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE);
958 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE);
959 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE);
960 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_present", FALSE);
961 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE);
962 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE);
963 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE);
964 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE);
965 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE);
966 }
967
968 PURPLE_INIT_PLUGIN(notify, init_plugin, info)

mercurial