Merge pull request #426 from bebehei/progress
Use '-1' for undefined progress
This commit is contained in:
		
						commit
						48fab3f887
					
				| @ -262,7 +262,7 @@ static void on_notify(GDBusConnection *connection, | ||||
|         n->raw_icon = raw_icon; | ||||
|         n->timeout = timeout < 0 ? -1 : timeout * 1000; | ||||
|         n->markup = settings.markup; | ||||
|         n->progress = (progress < 0 || progress > 100) ? 0 : progress + 1; | ||||
|         n->progress = (progress < 0 || progress > 100) ? -1 : progress; | ||||
|         n->urgency = urgency; | ||||
|         n->category = category; | ||||
|         n->dbus_client = g_strdup(sender); | ||||
|  | ||||
| @ -154,7 +154,7 @@ int dunst_main(int argc, char *argv[]) | ||||
|                 n->appname = g_strdup("dunst"); | ||||
|                 n->summary = g_strdup("startup"); | ||||
|                 n->body = g_strdup("dunst is up and running"); | ||||
|                 n->progress = 0; | ||||
|                 n->progress = -1; | ||||
|                 n->timeout = 10 * G_USEC_PER_SEC; | ||||
|                 n->markup = MARKUP_NO; | ||||
|                 n->urgency = LOW; | ||||
|  | ||||
| @ -359,23 +359,23 @@ void notification_init(notification *n) | ||||
|                                         MARKUP_NO); | ||||
|                                 break; | ||||
|                         case 'p': | ||||
|                                 if (n->progress) | ||||
|                                         sprintf(pg, "[%3d%%]", n->progress - 1); | ||||
|                                 if (n->progress != -1) | ||||
|                                         sprintf(pg, "[%3d%%]", n->progress); | ||||
| 
 | ||||
|                                 notification_replace_single_field( | ||||
|                                         &n->msg, | ||||
|                                         &substr, | ||||
|                                         n->progress ? pg : "", | ||||
|                                         n->progress != -1 ? pg : "", | ||||
|                                         MARKUP_NO); | ||||
|                                 break; | ||||
|                         case 'n': | ||||
|                                 if (n->progress) | ||||
|                                         sprintf(pg, "%d", n->progress - 1); | ||||
|                                 if (n->progress != -1) | ||||
|                                         sprintf(pg, "%d", n->progress); | ||||
| 
 | ||||
|                                 notification_replace_single_field( | ||||
|                                         &n->msg, | ||||
|                                         &substr, | ||||
|                                         n->progress ? pg : "", | ||||
|                                         n->progress != -1 ? pg : "", | ||||
|                                         MARKUP_NO); | ||||
|                                 break; | ||||
|                         case '%': | ||||
|  | ||||
| @ -54,7 +54,7 @@ typedef struct _notification { | ||||
|         bool first_render; | ||||
|         bool transient; | ||||
| 
 | ||||
|         int progress;           /* percentage + 1, 0 to hide */ | ||||
|         int progress;           /* percentage (-1: undefined) */ | ||||
|         int history_ignore; | ||||
|         const char *script; | ||||
|         char *urls; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Nikos Tsipinakis
						Nikos Tsipinakis