Пример #1
0
void handle_key(XCape_t *self, KeyMap_t *key,
		Bool mouse_pressed, int key_event) {

	if (key_event == KeyRelease) {
		unsigned n;
		int caps_state = 0;
		int num_state = 0;
		char msg[18] = "";
		char *key_name = XKeysymToString(key->ks);
		XkbGetIndicatorState(self->ctrl_conn, XkbUseCoreKbd, &n);

		if (self->debug)
			fprintf(stdout, "%s key state %d\n", key_name, n);

		caps_state = (n & 0x01) == 1;
		num_state = (n & 0x02) == 2;

		if (strcmp(key_name, "Num_Lock") == 0) {
			if (num_state) {
				strcpy(msg, "Num Lock is on");
			} else {
				strcpy(msg, "Num Lock is off");
			}
		}

		if (strcmp(key_name, "Caps_Lock") == 0) {
			if (caps_state) {
				strcpy(msg, "Caps Lock is on");
			} else {
				strcpy(msg, "Caps Lock is off");
			}
		}

		notify_init("Lock key pressed");
		NotifyNotification * notification = notify_notification_new(
				"Lock key pressed", msg, "dialog-information");
		notify_notification_show(notification, NULL);
		g_object_unref(G_OBJECT(notification));
		notify_uninit();
	}

	XFlush(self->ctrl_conn);
}
Пример #2
0
static void
fr_application_init (FrApplication *self)
{
#ifdef GDK_WINDOWING_X11
	egg_set_desktop_file (APPLICATIONS_DIR "/file-roller.desktop");
#else
	/* manually set name and icon */
	g_set_application_name (_("File Roller"));
	gtk_window_set_default_icon_name ("file-roller");
#endif

#ifdef ENABLE_NOTIFICATION
	if (! notify_init (g_get_application_name ()))
                g_warning ("Cannot initialize notification system.");
#endif /* ENABLE_NOTIFICATION */

	self->owner_id = 0;
	self->introspection_data = NULL;
}
Пример #3
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;
}
Пример #4
0
static void handle_message(char *msg) {
    printf("message received: %s\n", msg);

    struct message_t *message;
    char *title;
    char *icon;

    message = parse_message(msg);

    switch (message->event_type) {
        case Ring:
            asprintf(&title, "Call: %s", message->data);
            icon = "call-start";
            break;

        case SMS:
            asprintf(&title, "SMS: %s", message->data);
            icon = "stock_mail-unread";
            break;
        case MMS:
            asprintf(&title, "MMS: %s", message->data);
            icon = "stock_mail-unread";
            break;
        case Battery:
            asprintf(&title, "Battery: %s", message->data);
            icon = "battery-good"; // TODO: various levels and charge-state
            break;
        case Ping:
            title = "Ping";
            icon = "emblem-important";
            break;

        default:
            return;
    }

    notify_init("android-receiver");
    NotifyNotification *n = notify_notification_new(title, message->event_contents, icon);
    notify_notification_show(n, NULL);
    g_object_unref(G_OBJECT(n));
    notify_uninit();
}
Пример #5
0
int
main ()
{
    NotifyNotification *n;
    GError             *error;
    error = NULL;

    g_type_init ();

    notify_init ("Replace Test");

    n = notify_notification_new ("Summary",
                                 "First message",
                                 NULL);  //no icon

    notify_notification_set_timeout (n, 0); //don't timeout

    if (!notify_notification_show (n, &error)) {
        fprintf (stderr, "failed to send notification: %s\n",
                 error->message);
        g_error_free (error);
        return 1;
    }

    sleep (3);

    notify_notification_update (n,
                                "Second Summary",
                                "First mesage was replaced",
                                NULL);
    notify_notification_set_timeout (n, NOTIFY_EXPIRES_DEFAULT);

    if (!notify_notification_show (n, &error)) {
        fprintf (stderr,
                 "failed to send notification: %s\n",
                 error->message);
        g_error_free (error);
        return 1;
    }

    return 0;
}
Пример #6
0
/*****************************************************************************
 * Open: initialize and create stuff
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    intf_thread_t   *p_intf = (intf_thread_t *)p_this;
    intf_sys_t      *p_sys  = malloc( sizeof( *p_sys ) );

    if( !p_sys )
        return VLC_ENOMEM;

    if( !notify_init( APPLICATION_NAME ) )
    {
        free( p_sys );
        msg_Err( p_intf, "can't find notification daemon" );
        return VLC_EGENERIC;
    }
    p_intf->p_sys = p_sys;

    vlc_mutex_init( &p_sys->lock );
    p_sys->notification = NULL;
    p_sys->b_has_actions = false;

    GList *p_caps = notify_get_server_caps ();
    if( p_caps )
    {
        for( GList *c = p_caps; c != NULL; c = c->next )
        {
            if( !strcmp( (char*)c->data, "actions" ) )
            {
                p_sys->b_has_actions = true;
                break;
            }
        }
        g_list_foreach( p_caps, (GFunc)g_free, NULL );
        g_list_free( p_caps );
    }

    /* */
    playlist_t *p_playlist = pl_Hold( p_intf );
    var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
    pl_Release( p_intf );

    return VLC_SUCCESS;
}
int
main (int    argc,
      char **argv)
{
        GMainLoop *loop;

        gtk_init (&argc, &argv);
        notify_init ("gsd-disk-space-test");

        loop = g_main_loop_new (NULL, FALSE);

        gsd_ldsm_setup (TRUE);

        g_main_loop_run (loop);

        gsd_ldsm_clean ();
        g_main_loop_unref (loop);

        return 0;
}
Пример #8
0
void Notification::show()
{
    assert(note == nullptr);
    assert(name.size());

    notify_init(name.c_str());

    note = notify_notification_new(name.c_str(), content.c_str(), icon.c_str());
    notify_notification_set_timeout(note, timeout.count());
    notify_notification_set_category(note, "Testing Notifications");
    notify_notification_set_urgency(note, NOTIFY_URGENCY_NORMAL);

    GError* error = nullptr;
    notify_notification_show(note, &error);

    if (error != nullptr)
    {
        throw std::runtime_error("error during 'notify_notification_show");
    }
}
Пример #9
0
int
main (int argc, char **argv)
{
        GError *error = NULL;
        GOptionContext *context;

        setlocale (LC_ALL, "");

        textdomain (GETTEXT_PACKAGE);
        bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        g_set_application_name ("GeoClue Agent");

        notify_init (_("GeoClue"));

        context = g_option_context_new ("- Geoclue Agent service");
        g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
        if (!g_option_context_parse (context, &argc, &argv, &error)) {
                g_critical ("option parsing failed: %s\n", error->message);
                exit (-1);
        }

        if (version) {
                g_print ("%s\n", PACKAGE_VERSION);
                exit (0);
        }

        g_bus_get (G_BUS_TYPE_SYSTEM,
                   NULL,
                   on_get_bus_ready,
                   NULL);

        main_loop = g_main_loop_new (NULL, FALSE);
        g_main_loop_run (main_loop);

        if (agent != NULL);
                g_object_unref (agent);
        g_main_loop_unref (main_loop);

        return 0;
}
Пример #10
0
gint main (gint argc, gchar **argv)
{
  GMainLoop *loop;
  MailmeTelepathy *tp_provider;

  setlocale (LC_ALL, "");
  bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain(GETTEXT_PACKAGE);

  g_type_init ();

  /* Translators: 'application title' for the notifications, will be
     shown in e.g. gnome-shell message tray */
  notify_init (_("Unread mail"));

  loop = g_main_loop_new (NULL, FALSE);

  tp_provider = g_object_new (MAILME_TYPE_TELEPATHY, NULL);
  mailme_telepathy_prepare_async (tp_provider,
                                  on_tp_provider_prepared,
                                  loop);

  g_signal_connect (tp_provider,
                    "account-added",
                    G_CALLBACK (on_account_added),
                    NULL);

  g_signal_connect (tp_provider,
                    "account-removed",
                    G_CALLBACK (on_account_removed),
                    NULL);

  g_main_loop_run (loop);

  g_object_unref (tp_provider);
  g_object_unref (loop);
  notify_uninit ();

  return 0;
}
Пример #11
0
int
main (int argc, char *argv[])
{
        NotifyNotification *n;
        GtkWidget      *window;
        GtkWidget      *button;

        gtk_init (&argc, &argv);
        notify_init ("Replace Test");

        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        g_signal_connect (G_OBJECT (window),
                          "delete_event",
                          G_CALLBACK (gtk_main_quit),
                          NULL);

        button = gtk_button_new_with_label ("click here to change notification");
        gtk_container_add (GTK_CONTAINER (window), button);

        gtk_widget_show_all (window);

        n = notify_notification_new ("Widget Attachment Test",
                                     "Button has not been clicked yet",
                                     NULL, //no icon
                                     button);   //attach to button

        notify_notification_set_timeout (n, 0); //don't timeout

        g_signal_connect (G_OBJECT (button),
                          "clicked",
                          G_CALLBACK (on_clicked),
                          n);
        g_signal_connect_after (G_OBJECT (button),
                                "expose-event",
                                G_CALLBACK (on_exposed),
                                n);

        gtk_main ();

        return 0;
}
Пример #12
0
int main(int argc, char ** argv) {
	struct mnl_socket * nl;
	char buf[MNL_SOCKET_BUFFER_SIZE];
	int ret;

	program = argv[0];

	printf("%s: %s v%s (compiled: %s)\n", argv[0], PROGNAME, VERSION, DATE);

	if(!notify_init("Netlink-Notification")) {
		fprintf(stderr, "%s: Can't create notify.\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	nl = mnl_socket_open(NETLINK_ROUTE);
	if (!nl) {
		fprintf(stderr, "%s: Can't create netlink socket.\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	if (mnl_socket_bind(nl, RTMGRP_LINK, MNL_SOCKET_AUTOPID) < 0) {
		fprintf(stderr, "%s: Can't bind netlink socket.\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
	while (ret > 0) {
		ret = mnl_cb_run(buf, ret, 0, 0, data_cb, NULL);
		if (ret <= 0)
			break;
		ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
	}
	if (ret == -1) {
		fprintf(stderr, "%s: An error occured reading from netlink socket.\n", argv[0]);
		exit(EXIT_FAILURE);
	}

	mnl_socket_close(nl);

	return EXIT_SUCCESS;
}
Пример #13
0
int
main ()
{
        NotifyNotification *n;

        notify_init ("Markup");

        n = notify_notification_new ("Summary",
                                     "Some <b>bold</b>, <u>underlined</u>, <i>italic</i>, "
                                     "<a href='http://www.google.com'>linked</a> text",
                                     NULL,
                                     NULL);
        notify_notification_set_timeout (n, 3000);      //3 seconds

        if (!notify_notification_show (n, NULL)) {
                fprintf (stderr, "failed to send notification\n");
                return 1;
        }

        return 0;
}
Пример #14
0
static gboolean
thunar_notify_init (void)
{
  gchar *spec_version = NULL;

  if (!thunar_notify_initted
      && notify_init (PACKAGE_NAME))
    {
      /* we do this to work around bugs in libnotify < 0.6.0. Older
       * versions crash in notify_uninit() when no notifications are
       * displayed before. These versions also segfault when the
       * ret_spec_version parameter of notify_get_server_info is
       * NULL... */
      notify_get_server_info (NULL, NULL, NULL, &spec_version);
      g_free (spec_version);

      thunar_notify_initted = TRUE;
    }

  return thunar_notify_initted;
}
 void init() {
     if (!notify_is_initted()) {
         notify_init(QGSTRING(QCoreApplication::applicationName()));
     }
     
     Q_Q(QchNotification);
     notification = hildon_notification_new(QGSTRING(title), QGSTRING(text), QGSTRING(iconSource), NULL);
     notify_notification_add_action(NOTIFY_NOTIFICATION(notification), "default",
                                    QGSTRING(QCoreApplication::applicationName()),
                                    NOTIFY_ACTION_CALLBACK(onNotificationClicked), q, NULL);
     g_signal_connect(G_OBJECT(notification), "closed", G_CALLBACK(onNotificationClosed), q);
     
     setNotificationCategory();
     setNotificationHints();
     setNotificationSound();
     setNotificationTimeout();
     
     if (showOnInit) {
         showNotification();
     }
 }
Пример #16
0
int main(int argc, char * argv[] ) 
{
    NotifyNotification *n;  

    notify_init("Basics");

    n = notify_notification_new ("Summary", 
                                 "This is the message that we want to display\n幹\n",
                                  NULL, NULL);
//    notify_notification_set_timeout (n, 1); // 5 seconds

    if (!notify_notification_show (n, NULL)) 
    {
	fprintf(stderr, "failed to send notification\n");
	return 1;
    }

    g_object_unref(G_OBJECT(n));

    return 0;
}
Пример #17
0
static void
xfce_accessibility_helper_init (XfceAccessibilityHelper *helper)
{
    gint dummy;

    helper->channel = NULL;
#ifdef HAVE_LIBNOTIFY
    helper->notification = NULL;
#endif /* !HAVE_LIBNOTIFY */

    if (XkbQueryExtension (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &dummy, &dummy, &dummy, &dummy, &dummy))
    {
        /* open the channel */
        helper->channel = xfconf_channel_get ("accessibility");

        /* monitor channel changes */
        g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_accessibility_helper_channel_property_changed), helper);

        /* restore the xbd configuration */
        xfce_accessibility_helper_set_xkb (helper, XkbStickyKeysMask | XkbSlowKeysMask | XkbBounceKeysMask | XkbMouseKeysMask | XkbAccessXKeysMask);

#ifdef HAVE_LIBNOTIFY
        /* setup a connection with the notification daemon */
        if (!notify_init ("xfce4-settings-helper"))
            g_critical ("Failed to connect to the notification daemon.");

        /* add event filter */
        XkbSelectEvents (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), XkbUseCoreKbd, XkbControlsNotifyMask, XkbControlsNotifyMask);

        /* monitor all window events */
        gdk_window_add_filter (NULL, xfce_accessibility_helper_event_filter, helper);
#endif /* !HAVE_LIBNOTIFY */
    }
    else
    {
        /* warning */
        g_critical ("Failed to initialize the Accessibility extension.");
    }
}
Пример #18
0
int
main (int    argc,
      char **argv)
{
  MpdPowerIcon *icon;

  setlocale (LC_ALL, "");
  bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

  gtk_clutter_init (&argc, &argv);
  notify_init (_("Dawati Power Icon"));

  icon = mpd_power_icon_new ();

  clutter_main ();

  g_object_unref (icon);

  return EXIT_SUCCESS;
}
Пример #19
0
static int
newnotify (lua_State * L)
{
  NotifyNotification *notification = NULL;
  const char *summary, *body, *icon;
  GError *error = NULL;
  int top;

  if (!notify_is_initted() && !notify_init ("icon-summary-body")) {
    g_error_free (error);
    return luaL_error (L, "icon-summary-body");
  }

  top = lua_gettop(L);
  summary = luaL_checkstring (L, 1);

  body = (top > 1)
    ? luaL_checkstring (L, 2)
    : NULL;
  icon = (top > 2)
    ? luaL_checkstring (L, 3)
    : NULL;

  if (notification == (NotifyNotification *) 0) {
    notification = notify_notification_new (
      summary,
      body,
      icon
#if NOTIFY_CHECK_VERSION(0, 7, 0)
#else
      , NULL
#endif
    );
  }

  lua_pushlightuserdata (L, notification);

  return 1;
}
void Stick20ResponseTask::ShowIconMessage(const QString msg) {
  QString title = QString("Nitrokey App");
  int timeout = 3000;
#ifdef HAVE_LIBAPPINDICATOR
  if (isUnity()) {
    if (!notify_init("example"))
      return;

    NotifyNotification *notf;

    notf = notify_notification_new(title.toUtf8().data(), msg.toUtf8().data(), NULL);
    notify_notification_show(notf, NULL);
    notify_uninit();
  } else
#endif // HAVE_LIBAPPINDICATOR
  {
    if (TRUE == trayIcon->supportsMessages()) {
      trayIcon->showMessage(title, msg, QSystemTrayIcon::Information, timeout);
    } else
      csApplet()->messageBox(msg);
  }
}
int
main ()
{
        NotifyNotification *n;

        notify_init("Basics");

        n = notify_notification_new ("اختبار",
                                     "يوفر ويكي عربآيز مناخا للنقاش وتبادل الخبرات والمعرفة حول اللغة العربية ولسانياتها ومايتعلّق بدعمها والإرتقاء بها في الحوسبة عموماً والبرمجيات الحرة على وجه الخصوص. هذا الويكي عبارة عن بيئة تعاونية تشاركية مفتوحة للجميع بدون قيود، لغتنا الجميلة بانتظار مساهمتك فلا تبخل عليها ",
                                     NULL,
                                     NULL);
        notify_notification_set_timeout (n, 3000);

        if (!notify_notification_show (n, NULL)) {
                fprintf (stderr, "failed to send notification\n");
                return 1;
        }

        g_object_unref (G_OBJECT (n));

        return 0;
}
Пример #22
0
/*****************************************************************************
 * Open: initialize and create stuff
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    intf_thread_t   *p_intf = (intf_thread_t *)p_this;
    playlist_t      *p_playlist;
    intf_sys_t      *p_sys  = malloc( sizeof( intf_sys_t ) );

    if( !p_sys )
    {
        msg_Err( p_intf, "Out of memory" );
        return VLC_ENOMEM;
    }

    p_playlist = (playlist_t *)vlc_object_find(
                     p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );

    if( !p_playlist )
    {
        msg_Err( p_intf, "could not find playlist object" );
        return VLC_ENOOBJ;
    }

    var_AddCallback( p_playlist, "playlist-current", ItemChange, p_intf );
    /*    var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );*/

    vlc_object_release( p_playlist );

    if( !notify_init( APPLICATION_NAME ) )
    {
        msg_Err( p_intf, "can't find notification daemon" );
        return VLC_EGENERIC;
    }
    p_intf->p_sys = p_sys;
    vlc_mutex_init( p_this, &p_sys->lock );

    p_intf->pf_run = Run;
    msg_Dbg( p_intf,"notify plugin started");
    return VLC_SUCCESS;
}
Пример #23
0
int
main (int argc, char **argv)
{
  GnomeControlCenter *shell;
  GtkApplication *application;
  int status;

  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

#ifdef GDK_WINDOWING_X11
  XInitThreads ();
#endif

  gtk_init (&argc, &argv);
  cc_shell_log_init ();

  /* register a symbolic icon size for use in sidebar lists */
  gtk_icon_size_register ("cc-sidebar-list", 24, 24);

  notify_init ("gnome-control-center");

  shell = gnome_control_center_new ();

  /* enforce single instance of this application */
  application = gtk_application_new ("org.gnome.ControlCenter", G_APPLICATION_HANDLES_COMMAND_LINE);
  g_signal_connect (application, "startup",
                    G_CALLBACK (application_startup_cb), shell);
  g_signal_connect (application, "command-line",
                    G_CALLBACK (application_command_line_cb), shell);

  status = g_application_run (G_APPLICATION (application), argc, argv);

  g_object_unref (application);

  return status;
}
Пример #24
0
static int
setappname (lua_State * L)
{
  const char *name;
  NotifyNotification *notify;

  if (lua_gettop(L) < 2) {
    /* if there are less than two args, assume we're trying to set the default app name */
    name = luaL_checkstring(L, 1);
    if (notify_is_initted())
      notify_set_app_name(name);
    else
      notify_init(name);
  }
  else {
    notify = (NotifyNotification *) lua_touserdata(L, 1);
    if (!notify) luaL_argerror(L, 1, "Unknown type");
    name = luaL_checkstring(L, 2);
    notify_notification_set_app_name(notify, name);
  }

  return 0;
}
Пример #25
0
static void
test_synchronous_layout (void)
{

        notify_init (__FILE__);

	send_normal ("Hey, what about this restaurant? http://www.blafasel.org"
		     ""
		     "Would you go from your place by train or should I pick you up from work? What do you think?"
		);
	sleep (1);
	set_volume (0);
	sleep (1);
	set_volume (75);
	sleep (1);
	set_volume (90);
	sleep (1);
	set_volume (100);
	sleep (1);
	send_normal ("Ok, let's go for this one");
	sleep (1);
	set_volume (99);
}
Пример #26
0
LXMusicNotification lxmusic_do_notify_prepare(const gchar *artist, const gchar *title, const char *summary, GtkStatusIcon *status_icon)
{
#if HAVE_LIBNOTIFY
    if (!notify_is_initted ())
	notify_init ("LXMusic");
    GString* message = g_string_new("");
    if ( (artist != NULL) && (title != NULL ) ) {	
	/* metadata available */
	g_string_append_printf(message, "<b>%s: </b><i>%s</i>", _("Artist"), artist );
	g_string_append_printf(message, "\n<b>%s: </b><i>%s</i>", _("Title"), title );
    }
    /* use filename without markup */
    else 			
	g_string_append( message, title );
    struct _LXMusicNotification *lxn = g_new ( struct _LXMusicNotification, 1);
    lxn->notify = notify_notification_new (summary, message->str, NULL, NULL);
    notify_notification_set_urgency (lxn->notify, NOTIFY_URGENCY_NORMAL);
    notify_notification_attach_to_status_icon( lxn->notify, status_icon );
    notify_notification_set_timeout (lxn->notify, NOTIFY_EXPIRES_DEFAULT);
    g_string_free( message, TRUE );
    return lxn;
#endif	/* HAVE_LIBNOTIFY */
}
Пример #27
0
static int
ui_gtk_init(processor_config_t *config)
{
	ui_reg_handler("ui_open_frontpage", ui_gtk_open_frontpage);
 	ui_reg_handler("ui_query_ident_operation", ui_gtk_query_ident_operation);
	ui_reg_handler("ui_query_ca_operation", ui_gtk_query_ca_operation);
	ui_reg_handler("ui_print_import_result", ui_gtk_print_import_result);
	ui_reg_handler("ui_query_import_contacts", ui_gtk_query_import_contacts);

	ui_reg_handler("ui_print_error", ui_gtk_print_error);
	ui_reg_handler("ui_query_simple", ui_gtk_query_simple);
	ui_reg_handler("ui_query_three", ui_gtk_query_three);

	ui_reg_handler("ui_popup", ui_gtk_popup);

	ui_reg_handler("ui_query_filechooser", ui_gtk_query_filechooser);
	ui_reg_handler("ui_query_listchooserx", ui_gtk_query_listchooser);

#ifdef HAVE_LIBNOTIFY_NEW
	notify_init("p2pship");
#endif
	return 0;
}
Пример #28
0
int
main ()
{
        NotifyNotification *n;

        g_type_init ();

        notify_init ("Error Handling");

        n = notify_notification_new ("Summary", "Content", NULL);
        notify_notification_set_timeout (n, 3000);      //3 seconds

        /* TODO: Create an error condition */


        if (!notify_notification_show (n, NULL)) {
                fprintf (stderr, "failed to send notification\n");
                return 1;
        }


        return 0;
}
Пример #29
0
int
main(int argc, char *argv[])
{
  char *password = NULL;
  struct mpd_connection *conn = mpd_connection_new(mpd_check_host(NULL, &password), 0, 0);

  if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS)
  {
    fprintf(stderr,"%s: %s\n", argv[0], mpd_connection_get_error_message(conn));
    return 1;
  }

  if (password != NULL)
  {
    if (mpd_run_password(conn, password) == false)
    {
      fprintf(stderr, "%s: mpd_run_password %s\n", argv[0],
	  mpd_connection_get_error_message(conn));
      free(password);
      return 2;
    }
  }

  if (notify_init("MPD_Notification") == 0)
  {
    fprintf(stderr, "%s: Cannot initialize libnotify.\n", argv[0]);
    return 3;
  }

  infinite_loop(conn);

  mpd_connection_free(conn);
  free(password);
  notify_uninit();

  return 0;
}
Пример #30
0
DrWright *
drwright_new (void)
{
	DrWright *dr = g_new0 (DrWright, 1);

	if (debug) {
		setup_debug_values (dr);
	}

	if (!notify_is_initted ()) {
		notify_init (g_get_application_name ());
	}

	dr->timer = drw_timer_new ();
	dr->idle_timer = drw_timer_new ();

	dr->state = STATE_START;

	dr->monitor = drw_monitor_new ();

	g_signal_connect (dr->monitor,
			  "activity",
			  G_CALLBACK (activity_detected_cb),
			  dr);

	g_timeout_add_seconds (1,
			       (GSourceFunc) maybe_change_state,
			       dr);

        dr->settings = g_settings_new (DRW_SETTINGS_SCHEMA_ID);
        settings_change_cb (dr->settings, NULL, dr);
        g_signal_connect (dr->settings, "changed",
                          G_CALLBACK (settings_change_cb), dr);

	return dr;
}