Sponsored Content
Top Forums Programming libnotify (g_signal_connect() 3rd argument help) c++ Post 302530210 by hakermania on Monday 13th of June 2011 09:02:39 AM
Old 06-13-2011
Tools libnotify (g_signal_connect() 3rd argument help) c++

Hello, this is my code:
Code:
#include <glib.h>
#include <unistd.h>
#include <libnotify/notify.h>

void push_notification (gchar* title,
                   gchar* body,
                   gchar* icon)
{
        NotifyNotification* notification;
        gboolean            success;
        GError*             error = NULL;

        /* initial notification */
        notification = notify_notification_new (title, body, icon, NULL);
        notify_notification_set_hint_string (notification,
                                             "x-canonical-append",
                                             "");
        error = NULL;
        success = notify_notification_show (notification, &error);
        if (!success)
        {
                g_print ("That did not work ... \"%s\".\n",
                         error->message);
                g_error_free (error);
        }

        g_signal_connect(G_OBJECT (notification),
                          "closed",
                          G_CALLBACK (NULL),
                          NULL);
        g_object_unref (G_OBJECT (notification));
        notify_uninit ();
        sleep (3); /* simulate a user typing */
}

int main ()
{
        if (!notify_init ("append-hint-example"))
                return 1;


                push_notification ("Program",
                                   "Hello",
                                   "notification-message-im");

                push_notification ("Program",
                                   "how are you?",
                                   "notification-gsm-medium");

                push_notification ("Program",
                                   "Good to hear that",
                                   "notification-message-im");
        return 0;
}

It's the sample code provided by notify-osd's source for the append ability of notifications. In the g_signal_connect() function I have no idea what should I put as 3rd argument (inside the G_CALLBACK()i put NULL and it works just fine, but it outputs error message

Code:
 p, li { white-space: pre-wrap; }  GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `c_handler != NULL' failed

Im running Ubuntu 11.04 thanks in advance for any answers!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

argument help

if i have 2 arguments $1 and $2 how can i append them so that $2 is added to $1? It is really confusing me because it seems so simple, yet i can't get the shell script to work properly. Thanks. (2 Replies)
Discussion started by: brentdeback
2 Replies

2. UNIX for Dummies Questions & Answers

non-numeric argument

quick question, I am trying to run this simple equation expr 2048 / 2.354 but get a "expr: non-numeric argument" error when ever its run. I believe it may be caused by the decimal point but I do not know how to remedy it. (3 Replies)
Discussion started by: TiredOrangeCat
3 Replies

3. UNIX for Dummies Questions & Answers

How to find the last argument in a argument line?

How to find the last argument in a argument line? (4 Replies)
Discussion started by: nehagupta2008
4 Replies

4. Shell Programming and Scripting

get positive number n as argument script must calculate the factorial of its argument

Can someone please help me with this SHELL script? I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1. Here is a start but I have no clue how to... (3 Replies)
Discussion started by: I-1
3 Replies

5. Shell Programming and Scripting

Looping through the argument

Hi, I would like to perform a loop through the passing in argument, is there any method. I.e command> my_script a b c d my_script ---------- for i in $# echo $i done (3 Replies)
Discussion started by: dwgi32
3 Replies

6. Programming

How to display a notification with image? - Libnotify

Hi all, this is the code: #include <libnotify/notify.h> #include <stdio.h> #include <unistd.h> int main() { NotifyNotification *n; notify_init("Basics"); n = notify_notification_new ("Summary", "\nThis is the message that we want to... (0 Replies)
Discussion started by: hakermania
0 Replies

7. Shell Programming and Scripting

Cannot compare argument in if statement in csh/grep command if argument starts with “-“

If ($argv == “-debug”) then Echo “in loop” Endif But this is not working. If I modify this code and remove “-“, then it works. Similarly I am getting problem using grep command also Grep “-debug” Filename Can someone please help me on how to resolve these... (1 Reply)
Discussion started by: sarbjit
1 Replies

8. Shell Programming and Scripting

argument

Im sorry but I'm in need of help. How would I give the user the option to include the name of an html file as an arugment for the script? but if none is provided, then the script should prompt the user for the file name. I have sed 's/<*>//g' yourfile.html | uniq >newfile.txt so far I have... (7 Replies)
Discussion started by: clicstic
7 Replies

9. Shell Programming and Scripting

Make script that run with argument if not run from configuration file argument

Hello, Is there any method thorugh which script can take argument if pass otherwise if argument doesn't pass then it takes the argument from the configuration file i.e I am workiing on a script which will run through crontab and the script will chekout the code ,zip and copy to the... (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

10. UNIX for Advanced & Expert Users

Error:--test: argument expected--Even though i give an argument.

Hi All, I am running the script VBoxManage list vms |sed 's/"//g' | cut -d " " -f1 > har1out.mytxt result=`cat har1out.mytxt | grep $1' echo $result echo $1 { if then echo pass else echo fail fi (2 Replies)
Discussion started by: harsha85
2 Replies
ppmtosixel(1)                                                 General Commands Manual                                                ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 03:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy