Changeset d4946efe30b6cc3d3b901c8ec150f9810c020490

Show
Ignore:
Timestamp:
12/23/10 02:36:58 (2 years ago)
Author:
Nedko Arnaudov <nedko@…>
Children:
df4def70b2e17409817d2db70c5929d52cb489e7
Parents:
67ba277fa541fe5b84e61569febc36a2c72bc249
git-committer:
Nedko Arnaudov <nedko@arnaudov.name> / 2010-12-23T02:36:58Z+0200
Message:

gladish: Don't log dbus error when studio is not loaded on gladish start

Files:
5 modified

Legend:

Unmodified
Added
Removed
  • daemon/main.c

    r78e99c4 rd4946ef  
    190190  dbus_object_path_destroy(g_dbus_connection, g_control_object); 
    191191  dbus_connection_unref(g_dbus_connection); 
     192  dbus_call_last_error_cleanup(); 
    192193} 
    193194 
  • dbus/helpers.c

    rff83486 rd4946ef  
    4343DBusConnection * g_dbus_connection; 
    4444DBusError g_dbus_error; 
     45static char * g_dbus_call_last_error_name; 
     46static char * g_dbus_call_last_error_message; 
    4547 
    4648struct dbus_signal_hook_descriptor 
     
    6264 
    6365LIST_HEAD(g_dbus_services); 
     66 
     67 
     68void dbus_call_last_error_cleanup(void) 
     69{ 
     70  free(g_dbus_call_last_error_name); 
     71  g_dbus_call_last_error_name = NULL; 
     72 
     73  free(g_dbus_call_last_error_message); 
     74  g_dbus_call_last_error_message = NULL; 
     75} 
     76 
     77bool dbus_call_last_error_is_name(const char * name) 
     78{ 
     79  return g_dbus_call_last_error_name != NULL && strcmp(name, g_dbus_call_last_error_name) == 0; 
     80} 
     81 
     82const char * dbus_call_last_error_get_message(void) 
     83{ 
     84  return g_dbus_call_last_error_message != NULL ? g_dbus_call_last_error_message : ""; 
     85} 
     86 
     87static void dbus_call_last_error_set(void) 
     88{ 
     89  dbus_call_last_error_cleanup(); 
     90 
     91  if (g_dbus_error.name != NULL) 
     92  { 
     93    g_dbus_call_last_error_name = strdup(g_dbus_error.name); 
     94  } 
     95 
     96  if (g_dbus_error.message != NULL) 
     97  { 
     98    g_dbus_call_last_error_message = strdup(g_dbus_error.message); 
     99  } 
     100} 
    64101 
    65102bool dbus_iter_get_dict_entry(DBusMessageIter * iter_ptr, const char * key, void * value, int * type, int * size) 
     
    354391  if (reply_ptr == NULL) 
    355392  { 
    356     //log_error("calling method '%s' failed, error is '%s'", method, g_dbus_error.message); 
     393    dbus_call_last_error_set(); 
    357394    dbus_error_free(&g_dbus_error); 
    358395  } 
  • dbus/helpers.h

    rff83486 rd4946ef  
    112112  const char * service); 
    113113 
     114void dbus_call_last_error_cleanup(void); 
     115bool dbus_call_last_error_is_name(const char * name); 
     116const char * dbus_call_last_error_get_message(void); 
     117 
    114118#include "method.h" 
    115119#include "signal.h" 
  • gui/dbus.c

    r128ad4d rd4946ef  
    5656    dbus_error_free(&g_dbus_error); 
    5757  } 
     58 
     59  dbus_call_last_error_cleanup(); 
    5860} 
  • proxies/studio_proxy.c

    r7a6f304 rd4946ef  
    299299  if (!dbus_call(0, SERVICE_NAME, STUDIO_OBJECT_PATH, IFACE_STUDIO, "GetRoomList", "", NULL, &reply_ptr)) 
    300300  { 
    301     log_error("Cannot fetch studio room list"); 
     301    /* Don't log error if there is no studio loaded */ 
     302    if (!dbus_call_last_error_is_name(DBUS_ERROR_UNKNOWN_METHOD)) 
     303    { 
     304      log_error("Cannot fetch studio room list: %s", dbus_call_last_error_get_message()); 
     305    } 
     306 
    302307    return; 
    303308  }