Refactor notification_* functions to match queues namespace
This commit is contained in:
		
							parent
							
								
									12fa9d6ce1
								
							
						
					
					
						commit
						38e4bbb7bb
					
				| @ -282,7 +282,7 @@ static void on_close_notification(GDBusConnection *connection, | ||||
| { | ||||
|         guint32 id; | ||||
|         g_variant_get(parameters, "(u)", &id); | ||||
|         notification_close_by_id(id, 3); | ||||
|         queues_notification_close_id(id, 3); | ||||
|         wake_up(); | ||||
|         g_dbus_method_invocation_return_value(invocation, NULL); | ||||
|         g_dbus_connection_flush(connection, NULL, NULL, NULL); | ||||
|  | ||||
| @ -451,7 +451,7 @@ void notification_init(notification *n) | ||||
| 
 | ||||
|         /* TODO: this should not be part of notification_init */ | ||||
|         if (strlen(n->msg) == 0) { | ||||
|                 notification_close(n, 2); | ||||
|                 queues_notification_close(n, 2); | ||||
|                 if (settings.always_run_script) { | ||||
|                         notification_run_script(n); | ||||
|                 } | ||||
|  | ||||
							
								
								
									
										16
									
								
								src/queues.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/queues.c
									
									
									
									
									
								
							| @ -50,7 +50,7 @@ int queues_notification_insert(notification *n, int replaces_id) | ||||
| 
 | ||||
|         } else { | ||||
|                 n->id = replaces_id; | ||||
|                 if (!notification_replace_by_id(n)) | ||||
|                 if (!queues_notification_replace_id(n)) | ||||
|                         g_queue_insert_sorted(queue, n, notification_cmp_data, NULL); | ||||
|         } | ||||
| 
 | ||||
| @ -110,7 +110,7 @@ static int queues_stack_duplicate(notification *n) | ||||
|         return -1; | ||||
| } | ||||
| 
 | ||||
| bool notification_replace_by_id(notification *new) | ||||
| bool queues_notification_replace_id(notification *new) | ||||
| { | ||||
| 
 | ||||
|         for (GList *iter = g_queue_peek_head_link(displayed); | ||||
| @ -141,7 +141,7 @@ bool notification_replace_by_id(notification *new) | ||||
|         return false; | ||||
| } | ||||
| 
 | ||||
| int notification_close_by_id(int id, int reason) | ||||
| int queues_notification_close_id(int id, int reason) | ||||
| { | ||||
|         notification *target = NULL; | ||||
| 
 | ||||
| @ -174,20 +174,20 @@ int notification_close_by_id(int id, int reason) | ||||
|         return reason; | ||||
| } | ||||
| 
 | ||||
| int notification_close(notification *n, int reason) | ||||
| int queues_notification_close(notification *n, int reason) | ||||
| { | ||||
|         assert(n != NULL); | ||||
|         return notification_close_by_id(n->id, reason); | ||||
|         return queues_notification_close_id(n->id, reason); | ||||
| } | ||||
| 
 | ||||
| void move_all_to_history() | ||||
| { | ||||
|         while (displayed->length > 0) { | ||||
|                 notification_close(g_queue_peek_head_link(displayed)->data, 2); | ||||
|                 queues_notification_close(g_queue_peek_head_link(displayed)->data, 2); | ||||
|         } | ||||
| 
 | ||||
|         while (queue->length > 0) { | ||||
|                 notification_close(g_queue_peek_head_link(queue)->data, 2); | ||||
|                 queues_notification_close(g_queue_peek_head_link(queue)->data, 2); | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| @ -244,7 +244,7 @@ void queues_check_timeouts(bool idle) | ||||
| 
 | ||||
|                 /* remove old message */ | ||||
|                 if (g_get_monotonic_time() - n->start > n->timeout) { | ||||
|                         notification_close(n, 1); | ||||
|                         queues_notification_close(n, 1); | ||||
|                 } | ||||
|         } | ||||
| } | ||||
|  | ||||
| @ -40,7 +40,7 @@ int queues_notification_insert(notification *n, int replaces_id); | ||||
|  * Returns true, if a matching notification has been found | ||||
|  * and is replaced. Else false. | ||||
|  */ | ||||
| bool notification_replace_by_id(notification *new); | ||||
| bool queues_notification_replace_id(notification *new); | ||||
| 
 | ||||
| /*
 | ||||
|  * Close the notification that has id. | ||||
| @ -53,10 +53,10 @@ bool notification_replace_by_id(notification *new); | ||||
|  *  2 -> the notification was dismissed by the user_data | ||||
|  *  3 -> The notification was closed by a call to CloseNotification | ||||
|  */ | ||||
| int notification_close_by_id(int id, int reason); | ||||
| int queues_notification_close_id(int id, int reason); | ||||
| 
 | ||||
| /* Close the given notification. SEE notification_close_by_id. */ | ||||
| int notification_close(notification *n, int reason); | ||||
| /* Close the given notification. SEE queues_notification_close_id. */ | ||||
| int queues_notification_close(notification *n, int reason); | ||||
| 
 | ||||
| void history_pop(void); | ||||
| void history_push(notification *n); | ||||
|  | ||||
| @ -857,7 +857,7 @@ gboolean x_mainloop_fd_dispatch(GSource *source, GSourceFunc callback, | ||||
|                                 if (displayed) { | ||||
|                                         notification *n = g_queue_peek_head(displayed); | ||||
|                                         if (n) { | ||||
|                                                 notification_close(n, 2); | ||||
|                                                 queues_notification_close(n, 2); | ||||
|                                                 wake_up(); | ||||
|                                         } | ||||
|                                 } | ||||
| @ -939,7 +939,7 @@ static void x_handle_click(XEvent ev) | ||||
| 
 | ||||
|                 if (n) { | ||||
|                         if (ev.xbutton.button == Button1) | ||||
|                                 notification_close(n, 2); | ||||
|                                 queues_notification_close(n, 2); | ||||
|                         else | ||||
|                                 notification_do_action(n); | ||||
|                 } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine