Beispiel #1
0
static void
statusicon_set_inacall (StatusIcon *statusicon,
                        bool inacall)
{
  g_return_if_fail (statusicon != NULL);

  /* Update the status icon */
  if (inacall)
    gtk_status_icon_set_from_icon_name (GTK_STATUS_ICON (statusicon), "user-inacall");
  else
    statusicon_set_status (statusicon, statusicon->priv->status);
}
Beispiel #2
0
void
hippo_ui_get_screen_info(HippoUI          *ui,
                         HippoRectangle   *monitor_rect_p,
                         HippoRectangle   *tray_icon_rect_p,
                         HippoOrientation *tray_icon_orientation_p)
{
    GtkOrientation orientation;
    GdkScreen *screen;
    GdkRectangle icon_rect;
    GdkRectangle monitor;
    int monitor_num;
    
    gtk_status_icon_get_geometry(GTK_STATUS_ICON(ui->icon),
                                 &screen, 
                                 &icon_rect, 
                                 &orientation);

    if (monitor_rect_p) {
        HippoRectangle work_area;

        monitor_num = gdk_screen_get_monitor_at_point(screen,
                                                      icon_rect.x + icon_rect.width / 2,
                                                      icon_rect.y + icon_rect.height / 2);
        if (monitor_num < 0)
            monitor_num = 0;
        
        gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
        
        monitor_rect_p->x = monitor.x;
        monitor_rect_p->y = monitor.y;
        monitor_rect_p->width = monitor.width;
        monitor_rect_p->height = monitor.height;
        
        screen_get_work_area(screen, &work_area);
        hippo_rectangle_intersect(monitor_rect_p, &work_area, monitor_rect_p);
    }

    if (tray_icon_rect_p) {
        tray_icon_rect_p->x = icon_rect.x;
        tray_icon_rect_p->y = icon_rect.y;
        tray_icon_rect_p->width = icon_rect.width;
        tray_icon_rect_p->height = icon_rect.height;
    }

    if (tray_icon_orientation_p) {
        if (orientation == GTK_ORIENTATION_VERTICAL)
            *tray_icon_orientation_p = HIPPO_ORIENTATION_VERTICAL;
        else
            *tray_icon_orientation_p = HIPPO_ORIENTATION_HORIZONTAL;
    }
}
Beispiel #3
0
/*
  Read data and update tooltip
*/
gboolean
temp_notifier_timeout_func (temp_notifier_s *core)
{
  FILE *file;
  char string[50];
  char temperature[6];
  int i = 0, j = 0;

  /* Read CPU0's temperature */
  file = fopen (core->thermal_file_cpu0, "r");
  if (file != NULL)
  {
    fread (&string, sizeof (string), 1, file);
    snprintf (temperature, 3, "%c%c\0", string[25], string[26]);
    fclose (file);

    core->cpu0_temp = atoi (temperature);

    /* Check temperature */
    i = temp_notifier_check_temp (core->cpu0_temp, core->critical_temp);
	}
  else
    core->cpu0_temp = -1;
	
  /* Read CPU0's temperature */
  file = fopen (core->thermal_file_cpu1, "r");
  if (file != NULL)
  {
    fread (&string, sizeof (string), 1, file);
    snprintf (temperature, 3, "%c%c\0", string[25], string[26]);
    fclose (file);

    core->cpu1_temp = atoi (temperature);

    /* Check temperature */
    j = temp_notifier_check_temp (core->cpu1_temp, core->critical_temp);
  }
  else
    core->cpu1_temp = -1;
	
  /* Check GtkStatusIcon */
  if ((i == -1) || (j == -1))
    gtk_status_icon_set_blinking (GTK_STATUS_ICON(core->icon), TRUE);
  else
    gtk_status_icon_set_blinking (GTK_STATUS_ICON(core->icon), FALSE);

  /* Update GtkTooltip */
  if ((core->cpu0_temp == -1) && (core->cpu1_temp == -1))
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: ERROR\n- CPU2: ERROR"));
  else if (core->cpu0_temp == -1)
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: ERROR\n- CPU2: %d C", core->cpu1_temp));
  else if (core->cpu1_temp == -1)
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: %d C\n- CPU2: ERROR", core->cpu0_temp));
  else
    gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON(core->icon), g_strdup_printf ("- CPU1: %d C\n- CPU2: %d C", core->cpu0_temp, core->cpu1_temp));

  return TRUE;
}
Beispiel #4
0
static void _linphone_status_icon_impl_enable_blinking(LinphoneStatusIcon *si, gboolean val) {
    GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
    guint tout;
    tout=(unsigned)GPOINTER_TO_INT(g_object_get_data(G_OBJECT(icon),"timeout"));
    if (val && tout==0) {
        tout=g_timeout_add(500,(GSourceFunc)_linphone_status_icon_impl_gtk_do_icon_blink_cb,icon);
        g_object_set_data(G_OBJECT(icon),"timeout",GINT_TO_POINTER(tout));
    } else if (!val && tout!=0) {
        GdkPixbuf *normal_icon=g_object_get_data(G_OBJECT(icon),"icon");
        g_source_remove(tout);
        g_object_set_data(G_OBJECT(icon),"timeout",NULL);
        gtk_status_icon_set_from_pixbuf(icon,normal_icon);
    }
}
Beispiel #5
0
static void
statusicon_on_notification_added (boost::shared_ptr<Ekiga::Notification> notification,
                                  gpointer data)
{
  StatusIcon *self = STATUSICON (data);
  GdkPixbuf* pixbuf = gtk_widget_render_icon_pixbuf (self->priv->chat_window,
						     GTK_STOCK_DIALOG_WARNING,
						     GTK_ICON_SIZE_MENU);

  gchar *current_tooltip = gtk_status_icon_get_tooltip_text (GTK_STATUS_ICON (self));
  gchar *tooltip = NULL;
  if (current_tooltip != NULL)
    tooltip = g_strdup_printf ("%s\n%s", current_tooltip, notification->get_title ().c_str ());
  else
    tooltip = g_strdup (notification->get_title ().c_str ());

  gtk_status_icon_set_from_pixbuf (GTK_STATUS_ICON (self), pixbuf);
  gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), tooltip);
  g_object_unref (pixbuf);

  g_free (current_tooltip);
  g_free (tooltip);
}
Beispiel #6
0
GtkStatusIcon *init_notification(void)
{
	notify_init("bluetooth-manager");

	statusicon = gtk_status_icon_new_from_icon_name(icon_name);
	gtk_status_icon_set_title (GTK_STATUS_ICON (statusicon),
				   _("Bluetooth"));
	gtk_status_icon_set_tooltip_markup(statusicon, tooltip);

	/* XXX: Make sure the status icon is actually shown */
	gtk_status_icon_set_visible(statusicon, FALSE);
	gtk_status_icon_set_visible(statusicon, TRUE);

	return statusicon;
}
Beispiel #7
0
void qq_tray_stop_blinking_for(QQTray *tray, const gchar *uin)
{
    if(tray == NULL || uin == NULL){
        return;
    }

    QQTrayPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE(tray, qq_tray_get_type()
                                                    , QQTrayPriv);

    gchar *tmpuin = NULL;
    g_queue_clear(priv -> tmp_queue);
    while(!g_queue_is_empty(priv -> blinking_queue)){
        tmpuin = g_queue_pop_tail(priv -> blinking_queue);
        if(g_strcmp0(tmpuin, uin) == 0){
            //remove it
            g_free(tmpuin);
            break;
        }
        g_queue_push_head(priv -> tmp_queue, tmpuin);
    }
    while(!g_queue_is_empty(priv -> tmp_queue)){
        g_queue_push_tail(priv -> blinking_queue
                            , g_queue_pop_head(priv -> tmp_queue));
    }

    GdkPixbuf *pb;
    if(g_queue_is_empty(priv -> blinking_queue)){
        // no more blinking
        gtk_status_icon_set_blinking(GTK_STATUS_ICON(tray), FALSE);
        pb = gdk_pixbuf_new_from_file(IMGDIR"/webqq_icon.png", NULL);
        gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray), pb);
        g_object_unref(pb);
    }else{
        qq_tray_blinking(tray, g_queue_peek_tail(priv -> blinking_queue));
    }
}
Beispiel #8
0
static void
xmr_tray_icon_init(XmrTrayIcon *tray)
{
	XmrTrayIconPrivate *priv;

	tray->priv = G_TYPE_INSTANCE_GET_PRIVATE(tray, XMR_TYPE_TRAY_ICON, XmrTrayIconPrivate);

	priv = tray->priv;
	priv->popup_menu = NULL;
	priv->main_window = NULL;

	gtk_status_icon_set_tooltip_markup(GTK_STATUS_ICON(tray), "<b>xmradio</b>");

	g_signal_connect(tray, "popup-menu", G_CALLBACK(on_tray_popup_menu), NULL);
    g_signal_connect(tray, "activate", G_CALLBACK(on_tray_activate), NULL);
}
Beispiel #9
0
static gboolean
statusicon_blink_cb (gpointer data)
{
  StatusIcon *statusicon = STATUSICON (data);

  g_return_val_if_fail (data != NULL, false);

  if (statusicon->priv->blinking)
    gtk_status_icon_set_from_icon_name (GTK_STATUS_ICON (statusicon), "im-message");
  else
    statusicon_set_status (statusicon, statusicon->priv->status);

  statusicon->priv->blinking = !statusicon->priv->blinking;

  return true;
}
Beispiel #10
0
static void
sensor_added(IsManager *manager,
             IsSensor *sensor,
             IsIndicator *self)
{
  /* if a sensor has been added and we haven't yet got any enabled sensors
     to display (and hence no primary sensor), change our text to show
     this */
  if (!self->priv->menu_items)
  {
    is_indicator_set_label(self, _("No active sensors"));
#if !HAVE_APPINDICATOR
    gtk_status_icon_set_from_stock(GTK_STATUS_ICON(self),
                                   GTK_STOCK_DIALOG_WARNING);
#endif
  }
}
Beispiel #11
0
GtkStatusIcon *init_notification(void)
{
	notify_init("bluetooth-manager");

	icon_enabled = g_themed_icon_new_with_default_fallbacks (ACTIVE_ICON_NAME"-symbolic");
	icon_disabled = g_themed_icon_new_with_default_fallbacks (DISABLE_ICON_NAME"-symbolic");

	statusicon = gtk_status_icon_new_from_gicon(bt_enabled ? icon_enabled : icon_disabled);
	gtk_status_icon_set_title (GTK_STATUS_ICON (statusicon),
				   _("Bluetooth"));
	gtk_status_icon_set_tooltip_markup(statusicon, tooltip);

	/* XXX: Make sure the status icon is actually shown */
	gtk_status_icon_set_visible(statusicon, FALSE);
	gtk_status_icon_set_visible(statusicon, TRUE);

	return statusicon;
}
Beispiel #12
0
HippoStatusIcon*
hippo_status_icon_new(HippoDataCache *cache)
{
    HippoConnection *connection = hippo_data_cache_get_connection(cache);
    HippoStatusIcon *icon;
    
    icon = g_object_new(HIPPO_TYPE_STATUS_ICON,
                        "icon-name", get_icon_name(connection),
                        NULL);
    
    icon->cache = cache;
    g_object_ref(icon->cache);

    g_signal_connect(connection, "state-changed",
                     G_CALLBACK(on_state_changed), icon);

    gtk_status_icon_set_tooltip(GTK_STATUS_ICON(icon),
                                hippo_connection_get_tooltip(connection));

    return HIPPO_STATUS_ICON(icon);
}
Beispiel #13
0
static void
statusicon_activated_cb (G_GNUC_UNUSED GtkStatusIcon *icon,
                         gpointer data)
{
  StatusIcon *self = STATUSICON (data);

  // No unread messages => signal the gtk+ frontend
  // (should hide/present the main window)
  if (!self->priv->unread_messages) {

    g_signal_emit (self, signals, 0, NULL);
  }
  else {

    // Unread messages => show chat window
    gtk_window_present (GTK_WINDOW (self->priv->chat_window));
  }

  // Remove warnings from statusicon
  statusicon_set_status (STATUSICON (data), STATUSICON (data)->priv->status);
  gtk_status_icon_set_tooltip_text (GTK_STATUS_ICON (self), NULL);
}
Beispiel #14
0
int main (int argc, char *argv[])
{ 
  char *cwd;
  char *glade_path;
  struct s_gui_data data;  
  config_args args;
  args.config_path = NULL;
  monconf_parse_cli_args(&args, argc, argv);  
    
  monconf_prepare_config_directory();
  monconf *conf = monconf_create();
  monconf_read_config(conf, args.config_path);
  monconf_load_available_actions(conf);
  data.rstart.active = 0;
  data.lstart.active = 0;
  
  gtk_init (&argc, &argv);
  
  data.builder = gtk_builder_new ();
  glade_path = monconf_resolve_path("ui-glade/monarqui_gui.glade");
  gtk_builder_add_from_file (data.builder, glade_path, NULL);  
  g_free(glade_path);
  data.builder = GTK_BUILDER(data.builder);
  data.windowMain = GTK_WIDGET(gtk_builder_get_object (data.builder, "windowMain"));
  data.windowEntry = GTK_WIDGET(gtk_builder_get_object (data.builder, "windowEntry"));
  data.windowConfig = GTK_WIDGET(gtk_builder_get_object (data.builder, "windowConfig"));
  data.windowAction = GTK_WIDGET(gtk_builder_get_object (data.builder, "windowAction"));
  data.action_mainExit = GTK_ACTION(gtk_builder_get_object(data.builder, "action_mainExit"));
  data.action_configOpen = GTK_ACTION(gtk_builder_get_object(data.builder, "action_configOpen"));
  data.action_configClose = GTK_ACTION(gtk_builder_get_object(data.builder, "action_configClose"));
  data.action_startPause = GTK_ACTION(gtk_builder_get_object(data.builder, "action_startPause"));
  data.action_entryAdd = GTK_ACTION(gtk_builder_get_object(data.builder, "action_entryAdd"));
  data.action_entryModify = GTK_ACTION(gtk_builder_get_object(data.builder, "action_entryModify"));
  data.action_entryDuplicate = GTK_ACTION(gtk_builder_get_object(data.builder, "action_entryDuplicate"));
  data.action_entryDelete = GTK_ACTION(gtk_builder_get_object(data.builder, "action_entryDelete"));
  data.action_actionAdd = GTK_ACTION(gtk_builder_get_object(data.builder, "action_actionAdd"));
  data.action_actionModify = GTK_ACTION(gtk_builder_get_object(data.builder, "action_actionModify"));
  data.action_actionDelete = GTK_ACTION(gtk_builder_get_object(data.builder, "action_actionDelete"));
  data.action_saveConfig = GTK_ACTION(gtk_builder_get_object(data.builder, "action_saveConfig"));  
  data.action_toggleApplication = GTK_ACTION(gtk_builder_get_object(data.builder, "action_toggleApplication"));
  data.action_systrayPopup = GTK_ACTION(gtk_builder_get_object(data.builder, "action_systrayPopup"));
  data.image_startStop = GTK_IMAGE(gtk_builder_get_object(data.builder,"image_startStop"));  
  data.systrayIcon = GTK_STATUS_ICON(gtk_builder_get_object(data.builder,"systrayIcon"));  
  data.args = &args;
  data.conf = conf;
  data.treeviewActions = GTK_TREE_VIEW(gtk_builder_get_object(data.builder,"treeviewActions"));
  data.treeviewEntries = GTK_TREE_VIEW(gtk_builder_get_object(data.builder,"treeviewEntries"));
  data.treeviewEntryActions = GTK_TREE_VIEW(gtk_builder_get_object(data.builder,"treeviewEntryActions"));
  data.listStoreActions = GTK_LIST_STORE(gtk_builder_get_object(data.builder,"listStoreActions"));  
  data.listStoreEntries = GTK_LIST_STORE(gtk_builder_get_object(data.builder,"listStoreEntries"));
  data.listStoreEntryActions = GTK_LIST_STORE(gtk_builder_get_object(data.builder,"listStoreEntryActions"));  
  
  data.image_started = GTK_IMAGE(gtk_builder_get_object(data.builder,"image_started"));
  data.image_started_event = GTK_IMAGE(gtk_builder_get_object(data.builder,"image_started_event"));
  data.image_stopped = GTK_IMAGE(gtk_builder_get_object(data.builder,"image_stopped"));
  data.logged_event = FALSE;
  data.textbufferLog = GTK_TEXT_BUFFER(gtk_builder_get_object(data.builder, "textbufferLog"));
  
  data.systrayMenu = GTK_MENU(gtk_menu_new());
  data.systrayMenuItem_startStop = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Start"));
  data.systrayMenuItem_quit = GTK_MENU_ITEM(gtk_menu_item_new_with_label("Quit"));  
  
  
  gtk_menu_shell_append(GTK_MENU_SHELL(data.systrayMenu), GTK_WIDGET(data.systrayMenuItem_startStop));
  gtk_menu_shell_append(GTK_MENU_SHELL(data.systrayMenu), GTK_WIDGET(data.systrayMenuItem_quit));
    
  gtk_action_set_label(data.action_startPause, "Start");
  gtk_builder_connect_signals (data.builder, (gpointer)&data);    
     
  gtk_image_set_from_icon_name(data.image_startStop, ICON_NAME_START, GTK_ICON_SIZE_BUTTON);          
  gtk_status_icon_set_from_pixbuf(data.systrayIcon, gtk_image_get_pixbuf(data.image_stopped));
  populate_entries(&data);  
  populate_actions(&data);
  gtk_widget_show (data.windowMain);                
  gtk_main ();
  g_object_unref (G_OBJECT (data.builder));
  free(args.config_path);
  return 0;
}
Beispiel #15
0
int
main (int argc, char *argv[])
{
	signal_user_data_t *ud;
	GValue *preset;
	GError *error = NULL;
	GOptionContext *context;

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	if (!g_thread_supported())
		g_thread_init(NULL);
	context = g_option_context_new ("- Rip and encode DVD or MPEG file");
	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
#if !defined(_WIN32)
	g_option_context_add_group (context, gst_init_get_option_group ());
#endif
	g_option_context_parse (context, &argc, &argv, &error);
	g_option_context_free(context);

	if (argc > 1 && dvd_device == NULL && argv[1][0] != '-')
	{
		dvd_device = argv[1];
	}
	
	gtk_set_locale ();
	gtk_init (&argc, &argv);
	gtk_rc_parse_string(hud_rcstyle);
	g_type_class_unref(g_type_class_ref(GTK_TYPE_BUTTON));
	g_object_set(gtk_settings_get_default(), "gtk-button-images", TRUE, NULL);
#if !defined(_WIN32)
	notify_init("HandBrake");
#endif
	ghb_register_transforms();
	ghb_resource_init();
	ghb_load_icons();

#if !defined(_WIN32)
	dbus_g_thread_init();
#endif
	ghb_udev_init();

	ghb_write_pid_file();
	ud = g_malloc0(sizeof(signal_user_data_t));
	ud->debug = ghb_debug;
	g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
	g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, warn_log_handler, ud);
	//g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL, warn_log_handler, ud);
	ud->settings = ghb_settings_new();
	ud->builder = create_builder_or_die (BUILDER_NAME);
	// Enable events that alert us to media change events
	watch_volumes (ud);

	//GtkWidget *widget = GHB_WIDGET(ud->builder, "PictureDetelecineCustom");
	//gtk_entry_set_inner_border(widget, 2);

	// Since GtkBuilder no longer assigns object ids to widget names
	// Assign a few that are necessary for style overrides to work
	GtkWidget *widget;
#if defined(_NO_UPDATE_CHECK)
	widget = GHB_WIDGET(ud->builder, "check_updates_box");
	gtk_widget_hide(widget);
#endif

	widget = GHB_WIDGET(ud->builder, "preview_hud");
	gtk_widget_set_name(widget, "preview_hud");
	widget = GHB_WIDGET(ud->builder, "preview_window");
	gtk_widget_set_name(widget, "preview_window");

	// Set up the "hud" control overlay for the preview window
	GtkWidget *draw, *hud, *blender, *align;

	align = GHB_WIDGET(ud->builder, "preview_window_alignment");
	draw = GHB_WIDGET(ud->builder, "preview_image_align");
	hud = GHB_WIDGET(ud->builder, "preview_hud");

	// Set up compositing for hud
	blender = ghb_compositor_new();

	gtk_container_add(GTK_CONTAINER(align), blender);
	ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), draw, 1, 1);
	ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), hud, 2, .85);
	gtk_widget_show(blender);

	// Redirect stderr to the activity window
	ghb_preview_init(ud);
	IoRedirect(ud);
	ghb_log( "%s - %s - %s",
		HB_PROJECT_TITLE, HB_PROJECT_BUILD_TITLE, HB_PROJECT_URL_WEBSITE );
	ghb_init_dep_map();

	// Need to connect x264_options textview buffer to the changed signal
	// since it can't be done automatically
	GtkTextView *textview;
	GtkTextBuffer *buffer;
	textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "x264Option"));
	buffer = gtk_text_view_get_buffer (textview);
	g_signal_connect(buffer, "changed", (GCallback)x264_entry_changed_cb, ud);

	ghb_combo_init(ud);

	g_debug("ud %p\n", ud);
	g_debug("ud->builder %p\n", ud->builder);

	bind_audio_tree_model(ud);
	bind_subtitle_tree_model(ud);
	bind_presets_tree_model(ud);
	bind_queue_tree_model(ud);
	bind_chapter_tree_model(ud);
	// Connect up the signals to their callbacks
	// I wrote my own connector so that I could pass user data
	// to the callbacks.  Builder's standard autoconnect doesn't all this.
	gtk_builder_connect_signals_full (ud->builder, MyConnect, ud);

	// Load all internal settings
	ghb_settings_init(ud);
	// Load the presets files
	ghb_presets_load(ud);
	ghb_prefs_load(ud);

	ghb_prefs_to_ui(ud);

	gint logLevel;
	logLevel = ghb_settings_get_int(ud->settings, "LoggingLevel");
	ghb_backend_init(logLevel);

	if (ghb_settings_get_boolean(ud->settings, "hbfd"))
	{
		ghb_hbfd(ud, TRUE);
	}
	gchar *source = ghb_settings_get_string(ud->settings, "default_source");
	ghb_dvd_set_current(source, ud);
	g_free(source);

	// Parsing x264 options "" initializes x264 widgets to proper defaults
	ghb_x264_parse_options(ud, "");

	// Populate the presets tree view
	ghb_presets_list_init(ud, NULL, 0);
	// Get the first preset name
	if (arg_preset != NULL)
	{
		preset = ghb_parse_preset_path(arg_preset);
		if (preset)
		{
			ghb_select_preset(ud->builder, preset);
			ghb_value_free(preset);
		}
	}
	else
	{
		ghb_select_default_preset(ud->builder);
	}

	// Grey out widgets that are dependent on a disabled feature
	ghb_check_all_depencencies (ud);

	if (dvd_device != NULL)
	{
		// Source overridden from command line option
		ghb_settings_set_string(ud->settings, "scan_source", dvd_device);
		g_idle_add((GSourceFunc)ghb_idle_scan, ud);
	}
	// Reload and check status of the last saved queue
	g_idle_add((GSourceFunc)ghb_reload_queue, ud);

	// Start timer for monitoring libhb status, 500ms
	g_timeout_add (500, ghb_timer_cb, (gpointer)ud);

	// Add dvd devices to File menu
	ghb_volname_cache_init();
	g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);

	GtkStatusIcon *si;
	si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));

	gtk_status_icon_set_visible(si,
			ghb_settings_get_boolean(ud->settings, "show_status"));

#if GTK_CHECK_VERSION(2, 16, 0)
	gtk_status_icon_set_has_tooltip(si, TRUE);
	g_signal_connect(si, "query-tooltip", 
					status_icon_query_tooltip_cb, ud);
#else
	gtk_status_icon_set_tooltip(si, "HandBrake");
#endif

	// Ugly hack to keep subtitle table from bouncing around as I change
	// which set of controls are visible
	GtkRequisition req;
	gint height;
	
	widget = GHB_WIDGET(ud->builder, "SrtCodeset");
	gtk_widget_size_request( widget, &req );
	height = req.height;
	widget = GHB_WIDGET(ud->builder, "srt_code_label");
	gtk_widget_size_request( widget, &req );
	height += req.height;
	widget = GHB_WIDGET(ud->builder, "subtitle_table");
	gtk_widget_set_size_request(widget, -1, height);
	
	// Everything should be go-to-go.  Lets rock!

	gtk_main ();
	gtk_status_icon_set_visible(si, FALSE);
	ghb_backend_close();
	if (ud->queue)
		ghb_value_free(ud->queue);
	ghb_value_free(ud->settings);
	g_io_channel_unref(ud->activity_log);
	ghb_settings_close();
#if !defined(_WIN32)
	notify_uninit();
#endif
	g_free(ud);

	return 0;
}
Beispiel #16
0
SetIconText(GtkStatusIcon *tray_icon, const char *text, const char *color) {

  // build background from image
  GdkPixbuf* special_icon = gdk_pixbuf_new_from_file("message-mail-new.png", NULL); // GError **error);
  GdkPixbuf *dest = gdk_pixbuf_copy(special_icon);
  int w=gdk_pixbuf_get_width(special_icon);
  int h=gdk_pixbuf_get_height(special_icon);

  // prepare colors/alpha
  GdkColormap* cmap=gdk_screen_get_system_colormap(gdk_screen_get_default());
  int screen_depth=24;
  GdkVisual* visual = gdk_colormap_get_visual(cmap);
  screen_depth = visual->depth;
  GdkColor fore = { 0, 0, 0, 0 };
  GdkColor alpha  = { 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
  gdk_color_parse(color, &fore);
  if(fore.red==alpha.red && fore.green==alpha.green && fore.blue==alpha.blue) {
    alpha.red=0; // make sure alpha is different from fore
  }
  gdk_colormap_alloc_color (cmap, &fore, TRUE, TRUE);
  gdk_colormap_alloc_color (cmap, &alpha, TRUE, TRUE);

  // build pixmap with rectangle
  GdkPixmap *pm = gdk_pixmap_new (NULL, w, h, screen_depth);
  cairo_t *cr = gdk_cairo_create(pm);
  gdk_cairo_set_source_color(cr, &alpha);
/* void                gdk_cairo_set_source_color          (cairo_t *cr, */
/*                                                          const GdkColor *color); */
  cairo_rectangle(cr, 0, 0, w, h);
  /* void                cairo_rectangle                     (cairo_t *cr, */
  /*                                                          double x, */
  /*                                                          double y, */
  /*                                                          double width, */
  /*                                                          double height); */
  cairo_set_source_rgb(cr, 1, 1, 1);
  cairo_fill(cr);

  // build text
  GtkWidget *scratch = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  PangoLayout *layout = gtk_widget_create_pango_layout(scratch, NULL);
  gtk_widget_destroy(scratch);
  PangoFontDescription *fnt = pango_font_description_from_string("Sans 18");
  pango_font_description_set_weight (fnt,PANGO_WEIGHT_SEMIBOLD);
  pango_layout_set_spacing            (layout,0);
  pango_layout_set_font_description   (layout, fnt);
  pango_layout_set_text (layout, (gchar *)text,-1);
  int tw=0;
  int th=0;
  int sz;
  int border=4;
  pango_layout_get_pixel_size(layout, &tw, &th);
  while( (tw>w - border || th > h - border)) //fit text to the icon by decreasing font size
  {
    sz=pango_font_description_get_size (fnt);
    if(sz<MIN_FONT_SIZE) {
      sz=MIN_FONT_SIZE;
      break;
    }
    sz-=PANGO_SCALE;
    pango_font_description_set_size (fnt,sz);
    pango_layout_set_font_description   (layout, fnt);
    pango_layout_get_pixel_size(layout, &tw, &th);
  }
  pango_font_description_free (fnt);
  // center text
  int px, py;
  px=(w-tw)/2;
  py=(h-th)/2;

  // draw text on pixmap
  gdk_cairo_set_source_color(cr, &fore);
  cairo_move_to (cr, px, py);
  pango_cairo_show_layout (cr, layout);
  cairo_destroy(cr);
  g_object_unref (layout);

  GdkPixbuf *buf = gdk_pixbuf_get_from_drawable (NULL, pm, NULL, 0, 0, 0, 0, w, h);
  g_object_unref (pm);
  GdkPixbuf *alpha_buf = gdk_pixbuf_add_alpha(buf, TRUE, (guchar)alpha.red, (guchar)alpha.green, (guchar)alpha.blue);
  g_object_unref (buf);

  //merge the rendered text on top
  gdk_pixbuf_composite(alpha_buf,dest,0,0,w,h,0,0,1,1,GDK_INTERP_NEAREST,255);
  g_object_unref(alpha_buf);
  /* gdk_pixbuf_composite(buf,dest,0,0,w,h,0,0,1,1,GDK_INTERP_NEAREST,255); */
  /* g_object_unref(buf); */

  gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(tray_icon), GDK_PIXBUF(dest));
}
Beispiel #17
0
/*
 * Function: init_interface
 *
 * Creates the GUI according to 'arguments' structure.
 */
void init_interface(app_elems * interface, args * arguments, int source)
{
    interface->askedforkill = FALSE;

    GdkPixbuf *pixbuf;
    GError *error = NULL;
    int i, size = 10;

    /* Heading label text (sub-program command line) */
    for (i = 0; arguments->program[i] != NULL; i++) {
	size += strlen(arguments->program[i]) + 1;
    }
    char command[size];
    command[0] = '\0';
    for (i = 0; arguments->program[i] != NULL; i++) {
	strcat(command, arguments->program[i]);
	strncat(command, " ", size);
    }


    /* Main window */
    interface->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(interface->window), arguments->title);
    gtk_window_set_default_size(GTK_WINDOW(interface->window),
				arguments->width, arguments->height);
    gtk_container_set_border_width(GTK_CONTAINER(interface->window), 10);
    g_signal_connect(G_OBJECT(interface->window), "destroy",
		     G_CALLBACK(cb_close_or_reduce), interface);


    /* Notification icon */
    interface->icon = gtk_status_icon_new_from_file(arguments->iconpath);
    pixbuf = gdk_pixbuf_new_from_file(arguments->iconpath, &error);
    if (pixbuf == NULL) {
	fprintf(stderr, _("Can't find specified icon\n"));
    } else {
	gtk_window_set_icon(GTK_WINDOW(interface->window), pixbuf);
    }

    gtk_status_icon_set_tooltip_text(GTK_STATUS_ICON(interface->icon),
				     arguments->tooltip);
    gtk_status_icon_set_visible(GTK_STATUS_ICON(interface->icon), TRUE);
    g_signal_connect(GTK_STATUS_ICON(interface->icon), "activate",
		     G_CALLBACK(cb_toggle_display), interface);

    /* Body */
    /* To compile with GTK+2.0, replace by:
       GtkWidget *vb1 = gtk_vbox_new(FALSE, VPADDING);
       GtkWidget *hb1 = gtk_hbox_new(FALSE, HPADDING);
     */
    GtkWidget *vb1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, VPADDING);
    GtkWidget *hb1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, HPADDING);

    /* Quit button */
    GtkWidget *b1 = gtk_button_new_with_mnemonic(_("_Hide"));
    gtk_button_set_image(GTK_BUTTON(b1),
			 gtk_image_new_from_stock(GTK_STOCK_QUIT,
						  GTK_ICON_SIZE_BUTTON));
    g_signal_connect(G_OBJECT(b1), "clicked",
		     G_CALLBACK(cb_close_or_reduce), interface);
    interface->quitbutton = b1;

    /* Kill button */
    GtkWidget *b2 = gtk_button_new_with_mnemonic(_("_Stop (SIGINT)"));
    gtk_button_set_image(GTK_BUTTON(b2),
			 gtk_image_new_from_stock(GTK_STOCK_STOP,
						  GTK_ICON_SIZE_BUTTON));
    g_signal_connect(G_OBJECT(b2), "clicked", G_CALLBACK(cb_kill_child),
		     interface);
    interface->killbutton = b2;


    //STDOUT & STDERR Scrolling TextView
    GtkWidget *stdout_child = gtk_text_view_new();
    gtk_text_view_set_editable(GTK_TEXT_VIEW(stdout_child), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(stdout_child), FALSE);
    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(stdout_child),
				GTK_WRAP_CHAR);
    gtk_widget_modify_font(stdout_child,
			   pango_font_description_from_string
			   ("monospace"));

    add_textview_refresher(GTK_TEXT_VIEW(stdout_child), source);
    GtkWidget *scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll),
					GTK_SHADOW_IN);

    gtk_container_add(GTK_CONTAINER(scroll), stdout_child);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
				   GTK_POLICY_AUTOMATIC,
				   GTK_POLICY_AUTOMATIC);

    /* Heading label */
    GtkWidget *command_line = gtk_label_new(command);
    gtk_label_set_line_wrap(GTK_LABEL(command_line), TRUE);
    gtk_label_set_line_wrap_mode(GTK_LABEL(command_line), GTK_WRAP_CHAR);
    gtk_widget_modify_font(command_line,
			   pango_font_description_from_string("bold"));

    /* Line break checkbox */
    GtkWidget *ch1 = gtk_check_button_new_with_mnemonic(_("_Line breaks"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ch1), TRUE);
    g_signal_connect(G_OBJECT(ch1), "toggled",
		     G_CALLBACK(cb_toggle_line_break), stdout_child);


    /* Link all widgets together */
    gtk_box_pack_end(GTK_BOX(hb1), b1, FALSE, FALSE, 0);
    gtk_box_pack_end(GTK_BOX(hb1), b2, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(hb1), ch1, FALSE, FALSE, 0);

    gtk_box_pack_start(GTK_BOX(vb1), command_line, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vb1), scroll, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(vb1), hb1, FALSE, FALSE, 0);

    gtk_container_add(GTK_CONTAINER(interface->window), vb1);
}
Beispiel #18
0
int
main (int argc, char *argv[])
{
	signal_user_data_t *ud;
	GValue *preset;
	GError *error = NULL;
	GOptionContext *context;

#ifdef ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);
#endif

	if (!g_thread_supported())
		g_thread_init(NULL);
	context = g_option_context_new ("- Transcode media formats");
	g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
#if defined(_ENABLE_GST)
	g_option_context_add_group (context, gst_init_get_option_group ());
#endif
	g_option_context_parse (context, &argc, &argv, &error);
	g_option_context_free(context);

	if (argc > 1 && dvd_device == NULL && argv[1][0] != '-')
	{
		dvd_device = argv[1];
	}
	
	gtk_init (&argc, &argv);
	gtk_rc_parse_string(hud_rcstyle);
	g_type_class_unref(g_type_class_ref(GTK_TYPE_BUTTON));
	g_object_set(gtk_settings_get_default(), "gtk-button-images", TRUE, NULL);
#if !defined(_WIN32)
	notify_init("HandBrake");
#endif
	ghb_register_transforms();
	ghb_resource_init();
	ghb_load_icons();

#if !defined(_WIN32)
	dbus_g_thread_init();
#endif
	ghb_udev_init();

	ghb_write_pid_file();
	ud = g_malloc0(sizeof(signal_user_data_t));
	ud->debug = ghb_debug;
	g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, debug_log_handler, ud);
	g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, warn_log_handler, ud);
	//g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL, warn_log_handler, ud);
	ud->settings = ghb_settings_new();
	ud->builder = create_builder_or_die (BUILDER_NAME);
	// Enable events that alert us to media change events
	watch_volumes (ud);

	//GtkWidget *widget = GHB_WIDGET(ud->builder, "PictureDetelecineCustom");
	//gtk_entry_set_inner_border(widget, 2);

	// Since GtkBuilder no longer assigns object ids to widget names
	// Assign a few that are necessary for style overrides to work
	GtkWidget *widget;
#if defined(_NO_UPDATE_CHECK)
	widget = GHB_WIDGET(ud->builder, "check_updates_box");
	gtk_widget_hide(widget);
#endif

	widget = GHB_WIDGET(ud->builder, "preview_hud");
	gtk_widget_set_name(widget, "preview_hud");
	widget = GHB_WIDGET(ud->builder, "preview_window");
	gtk_widget_set_name(widget, "preview_window");

	// Set up the "hud" control overlay for the preview window
	GtkWidget *draw, *hud, *blender, *align;

	align = GHB_WIDGET(ud->builder, "preview_window_alignment");
	draw = GHB_WIDGET(ud->builder, "preview_image_align");
	hud = GHB_WIDGET(ud->builder, "preview_hud");

	// Set up compositing for hud
	blender = ghb_compositor_new();

	gtk_container_add(GTK_CONTAINER(align), blender);
	ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), draw, 1, 1);
	ghb_compositor_zlist_insert(GHB_COMPOSITOR(blender), hud, 2, .85);
	gtk_widget_show(blender);

	// Redirect stderr to the activity window
	ghb_preview_init(ud);
	IoRedirect(ud);
	ghb_log( "%s - %s - %s",
		HB_PROJECT_TITLE, HB_PROJECT_BUILD_TITLE, HB_PROJECT_URL_WEBSITE );
	ghb_init_dep_map();

	// Need to connect x264_options textview buffer to the changed signal
	// since it can't be done automatically
	GtkTextView *textview;
	GtkTextBuffer *buffer;
	textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "x264Option"));
	buffer = gtk_text_view_get_buffer (textview);
	g_signal_connect(buffer, "changed", (GCallback)x264_entry_changed_cb, ud);

	ghb_combo_init(ud);

	g_debug("ud %p\n", ud);
	g_debug("ud->builder %p\n", ud->builder);

	bind_audio_tree_model(ud);
	bind_subtitle_tree_model(ud);
	bind_presets_tree_model(ud);
	bind_queue_tree_model(ud);
	bind_chapter_tree_model(ud);
	// Connect up the signals to their callbacks
	// I wrote my own connector so that I could pass user data
	// to the callbacks.  Builder's standard autoconnect doesn't all this.
	gtk_builder_connect_signals_full (ud->builder, MyConnect, ud);

	// Load all internal settings
	ghb_settings_init(ud);
	// Load the presets files
	ghb_presets_load(ud);
	ghb_prefs_load(ud);

	ghb_prefs_to_ui(ud);

	gint logLevel;
	logLevel = ghb_settings_get_int(ud->settings, "LoggingLevel");
	ghb_backend_init(logLevel);

	if (ghb_settings_get_boolean(ud->settings, "hbfd"))
	{
		ghb_hbfd(ud, TRUE);
	}
	gchar *source = ghb_settings_get_string(ud->settings, "default_source");
	ghb_dvd_set_current(source, ud);
	g_free(source);

	// Parsing x264 options "" initializes x264 widgets to proper defaults
	ghb_x264_parse_options(ud, "");

	// Populate the presets tree view
	ghb_presets_list_init(ud, NULL, 0);
	// Get the first preset name
	if (arg_preset != NULL)
	{
		preset = ghb_parse_preset_path(arg_preset);
		if (preset)
		{
			ghb_select_preset(ud->builder, preset);
			ghb_value_free(preset);
		}
	}
	else
	{
		ghb_select_default_preset(ud->builder);
	}

	// Grey out widgets that are dependent on a disabled feature
	ghb_check_all_depencencies (ud);

	if (dvd_device != NULL)
	{
		// Source overridden from command line option
		ghb_settings_set_string(ud->settings, "scan_source", dvd_device);
		g_idle_add((GSourceFunc)ghb_idle_scan, ud);
	}
	// Reload and check status of the last saved queue
	g_idle_add((GSourceFunc)ghb_reload_queue, ud);

	// Start timer for monitoring libhb status, 500ms
	g_timeout_add (500, ghb_timer_cb, (gpointer)ud);

	// Add dvd devices to File menu
	ghb_volname_cache_init();
	g_thread_create((GThreadFunc)ghb_cache_volnames, ud, FALSE, NULL);

#if defined(_USE_APP_IND)
	GtkUIManager * uim = GTK_UI_MANAGER(GHB_OBJECT(ud->builder, "uimanager1"));

	GtkMenu *ai_menu = GTK_MENU(gtk_ui_manager_get_widget(uim, "/ui/tray_menu"));
	ud->ai = app_indicator_new("HandBrake", "hb-icon", APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
	app_indicator_set_menu( ud->ai, ai_menu );
	app_indicator_set_label( ud->ai, "", "99.99%");
	if (ghb_settings_get_boolean(ud->settings, "show_status"))
	{
		app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_ACTIVE );
	}
	else
	{
		app_indicator_set_status( ud->ai, APP_INDICATOR_STATUS_PASSIVE );
	}
	GtkStatusIcon *si;
	si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));

	gtk_status_icon_set_visible(si, FALSE );
#else
	GtkStatusIcon *si;
	si = GTK_STATUS_ICON(GHB_OBJECT(ud->builder, "hb_status"));

	gtk_status_icon_set_visible(si,
			ghb_settings_get_boolean(ud->settings, "show_status"));

#if GTK_CHECK_VERSION(2, 16, 0)
	gtk_status_icon_set_has_tooltip(si, TRUE);
	g_signal_connect(si, "query-tooltip", 
					status_icon_query_tooltip_cb, ud);
#else
	gtk_status_icon_set_tooltip(si, "HandBrake");
#endif
#endif

	// Ugly hack to keep subtitle table from bouncing around as I change
	// which set of controls are visible
	GtkRequisition req;
	gint width, height;
	
	widget = GHB_WIDGET(ud->builder, "SrtCodeset");
	gtk_widget_size_request( widget, &req );
	height = req.height;
	widget = GHB_WIDGET(ud->builder, "srt_code_label");
	gtk_widget_size_request( widget, &req );
	height += req.height;
	widget = GHB_WIDGET(ud->builder, "subtitle_table");
	gtk_widget_set_size_request(widget, -1, height);
	
	widget = GHB_WIDGET (ud->builder, "hb_window");

	GdkGeometry geo = { 
		-1, -1, 1024, 768, -1, -1, 10, 10, 0, 0, GDK_GRAVITY_NORTH_WEST
	};
	GdkWindowHints geo_mask;
	geo_mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE | GDK_HINT_BASE_SIZE;
	gtk_window_set_geometry_hints( GTK_WINDOW(widget), widget, &geo, geo_mask);
	width = ghb_settings_get_int(ud->settings, "window_width");
	height = ghb_settings_get_int(ud->settings, "window_height");
	gtk_window_resize(GTK_WINDOW(widget), width, height);
	gtk_widget_show(widget);

	/*
 	 * Filter objects in GtkBuilder xml
 	 * Unfortunately, GtkFilter is poorly supported by GtkBuilder,
 	 * so a lot of the setup must happen in code.
		SourceFilterAll
		SourceFilterVideo
		SourceFilterTS
		SourceFilterMPG
		SourceFilterEVO
		SourceFilterVOB
		SourceFilterMKV
		SourceFilterMP4
		SourceFilterAVI
		SourceFilterMOV
		SourceFilterOGG
		SourceFilterFLV
		SourceFilterWMV
	*/
	// Add filters to source chooser
	GtkFileFilter *filter;
	GtkFileChooser *chooser;
	chooser = GTK_FILE_CHOOSER(GHB_WIDGET(ud->builder, "source_dialog"));
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll"));
	gtk_file_filter_set_name(filter, "All");
	gtk_file_filter_add_pattern(filter, "*");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVideo"));
	gtk_file_filter_set_name(filter, "Video");
	gtk_file_filter_add_mime_type(filter, "video/*");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterTS"));
	gtk_file_filter_set_name(filter, "TS");
	gtk_file_filter_add_pattern(filter, "*.ts");
	gtk_file_filter_add_pattern(filter, "*.TS");
	gtk_file_filter_add_pattern(filter, "*.m2ts");
	gtk_file_filter_add_pattern(filter, "*.M2TS");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMPG"));
	gtk_file_filter_set_name(filter, "MPG");
	gtk_file_filter_add_pattern(filter, "*.mpg");
	gtk_file_filter_add_pattern(filter, "*.MPG");
	gtk_file_filter_add_pattern(filter, "*.mepg");
	gtk_file_filter_add_pattern(filter, "*.MEPG");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterEVO"));
	gtk_file_filter_set_name(filter, "EVO");
	gtk_file_filter_add_pattern(filter, "*.evo");
	gtk_file_filter_add_pattern(filter, "*.EVO");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterVOB"));
	gtk_file_filter_set_name(filter, "VOB");
	gtk_file_filter_add_pattern(filter, "*.vob");
	gtk_file_filter_add_pattern(filter, "*.VOB");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMKV"));
	gtk_file_filter_set_name(filter, "MKV");
	gtk_file_filter_add_pattern(filter, "*.mkv");
	gtk_file_filter_add_pattern(filter, "*.MKV");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMP4"));
	gtk_file_filter_set_name(filter, "MP4");
	gtk_file_filter_add_pattern(filter, "*.mp4");
	gtk_file_filter_add_pattern(filter, "*.MP4");
	gtk_file_filter_add_pattern(filter, "*.m4v");
	gtk_file_filter_add_pattern(filter, "*.M4V");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterMOV"));
	gtk_file_filter_set_name(filter, "MOV");
	gtk_file_filter_add_pattern(filter, "*.mov");
	gtk_file_filter_add_pattern(filter, "*.MOV");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAVI"));
	gtk_file_filter_set_name(filter, "AVI");
	gtk_file_filter_add_pattern(filter, "*.avi");
	gtk_file_filter_add_pattern(filter, "*.AVI");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterOGG"));
	gtk_file_filter_set_name(filter, "OGG");
	gtk_file_filter_add_pattern(filter, "*.ogg");
	gtk_file_filter_add_pattern(filter, "*.OGG");
	gtk_file_filter_add_pattern(filter, "*.ogv");
	gtk_file_filter_add_pattern(filter, "*.OGV");
	gtk_file_filter_add_pattern(filter, "*.ogm");
	gtk_file_filter_add_pattern(filter, "*.OGM");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterFLV"));
	gtk_file_filter_set_name(filter, "FLV");
	gtk_file_filter_add_pattern(filter, "*.flv");
	gtk_file_filter_add_pattern(filter, "*.FLV");
	gtk_file_chooser_add_filter(chooser, filter);
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterWMV"));
	gtk_file_filter_set_name(filter, "WMV");
	gtk_file_filter_add_pattern(filter, "*.wmv");
	gtk_file_filter_add_pattern(filter, "*.WMV");
	gtk_file_chooser_add_filter(chooser, filter);

	// Gtk has a really stupid bug.  If the file chooser is showing
	// hidden files AND there is no filter set, it will not select
	// the filename when gtk_file_chooser_set_filename is called.
	// So add a completely unnessary filter to prevent this behavior.
	filter = GTK_FILE_FILTER(GHB_OBJECT(ud->builder, "SourceFilterAll"));
	gtk_file_chooser_set_filter(chooser, filter);

	PangoFontDescription *font_desc;
	font_desc = pango_font_description_from_string ("monospace 10");
	textview = GTK_TEXT_VIEW(GHB_WIDGET (ud->builder, "activity_view"));
	gtk_widget_modify_font(GTK_WIDGET(textview), font_desc);      
	pango_font_description_free (font_desc);      

	// Everything should be go-to-go.  Lets rock!

	gtk_main ();
	gtk_status_icon_set_visible(si, FALSE);
	ghb_backend_close();
	if (ud->queue)
		ghb_value_free(ud->queue);
	ghb_value_free(ud->settings);
	g_io_channel_unref(ud->activity_log);
	ghb_settings_close();
#if !defined(_WIN32)
	notify_uninit();
#endif
	g_free(ud);

	return 0;
}
Beispiel #19
0
void cgraphics_status_icon_set_tooltip(status_icon_t * status, const char * tooltip)
{
    gtk_status_icon_set_tooltip(GTK_STATUS_ICON(status), tooltip);
}
Beispiel #20
0
void cgraphics_status_icon_set_icon(status_icon_t * status, image_t * icon)
{
    gtk_status_icon_set_from_pixbuf(GTK_STATUS_ICON(status->native), (GdkPixbuf*)icon->native);
}
Beispiel #21
0
static void _linphone_status_icon_impl_gtk_uninit(LinphoneStatusIcon *si) {
    GtkStatusIcon *icon = GTK_STATUS_ICON(si->data);
    gtk_status_icon_set_visible(icon, FALSE);
}
Beispiel #22
0
void xmr_tray_icon_set_tooltips(XmrTrayIcon *tray, const gchar *text)
{
	g_return_if_fail(tray != NULL && text != NULL);

	gtk_status_icon_set_tooltip_markup(GTK_STATUS_ICON(tray), text);
}
Beispiel #23
0
void
hippo_ui_show(HippoUI *ui)
{
    gtk_status_icon_set_visible(GTK_STATUS_ICON(ui->icon), TRUE);
}
Beispiel #24
0
static void
update_sensor_menu_item_label(IsIndicator *self,
                              IsSensor *sensor,
                              GtkMenuItem *menu_item)
{
  gchar *text;

  text = g_strdup_printf("%s %2.*f%s",
                         is_sensor_get_label(sensor),
                         is_sensor_get_digits(sensor),
                         is_sensor_get_value(sensor),
                         is_sensor_get_units(sensor));
  gtk_menu_item_set_label(menu_item, text);
  g_free(text);
  text = NULL;

#if HAVE_APPINDICATOR
  if (sensor == self->priv->primary)
  {
    IsIndicatorPrivate *priv = self->priv;
    gboolean connected;

    g_object_get(self, "connected", &connected, NULL);
    /* using fallback so just set icon */
    if (!connected)
    {
      app_indicator_set_icon_full(APP_INDICATOR(self), PACKAGE,
                                  is_sensor_get_label(sensor));
      return;
    }

    if (priv->display_flags & IS_INDICATOR_DISPLAY_VALUE)
    {
      text = g_strdup_printf("%2.*f%s",
                             is_sensor_get_digits(sensor),
                             is_sensor_get_value(sensor),
                             is_sensor_get_units(sensor));
    }
    if (priv->display_flags & IS_INDICATOR_DISPLAY_LABEL)
    {
      /* join label to existing text - if text is NULL this
         will just show label */
      text = g_strjoin(" ",
                       is_sensor_get_label(sensor),
                       text, NULL);
    }
    if (priv->display_flags & IS_INDICATOR_DISPLAY_ICON)
    {
      app_indicator_set_icon_full(APP_INDICATOR(self),
                                  is_sensor_get_icon_path(sensor),
                                  is_sensor_get_label(sensor));
    }
    else
    {
      /* set to a 1x1 transparent icon for no icon */
      app_indicator_set_icon_full(APP_INDICATOR(self), "indicator-sensors-no-icon",
                                  is_sensor_get_label(sensor));

    }
    app_indicator_set_label(APP_INDICATOR(self), text, text);
    g_free(text);
    app_indicator_set_status(APP_INDICATOR(self),
                             is_sensor_get_alarmed(sensor) ?
                             APP_INDICATOR_STATUS_ATTENTION :
                             APP_INDICATOR_STATUS_ACTIVE);
  }
#else
  gtk_status_icon_set_from_icon_name(GTK_STATUS_ICON(self), PACKAGE);
#endif

}
Beispiel #25
0
int main(int argc, char **argv)
{
	int o;
	char *name = "Master";
	char *iname = "Capture";
	int showinput = 0;

	bindtextdomain("tray_mixer", LOCALE_DIR);
	textdomain("tray_mixer");

	while ((o = getopt(argc, argv, "e:Ii:")) >= 0) {
		switch (o) {
		case 'e':
			name = optarg;
			break;
		case 'i':
			iname = optarg;
			/* fall through */
		case 'I':
			showinput = 1;
			break;
		}
	}

	gtk_init(&argc, &argv);

	mixer_init(name, iname);

	icon = gtk_status_icon_new_from_file(ICON_PATH "speaker.png");
	g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(click), NULL);

	item = gtk_menu_item_new_with_label(_("Quit"));
	menu = gtk_menu_new();
	gtk_widget_show(item);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);

	g_signal_connect(G_OBJECT(icon), "popup-menu", G_CALLBACK(popup), NULL);
	g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(quit), NULL);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(window), 10);
	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(window), TRUE);
	gtk_window_set_skip_pager_hint(GTK_WINDOW(window), TRUE);
	gtk_window_set_type_hint(GTK_WINDOW(window),
					GDK_WINDOW_TYPE_HINT_DIALOG);
	gtk_window_set_default_size(GTK_WINDOW(window), 60, 140);

	hbox = gtk_hbox_new(TRUE, 5);
	gtk_container_add(GTK_CONTAINER(window), hbox);

	add_channel(&ch[0]);

	if (showinput)
		add_channel(&ch[1]);

	gtk_status_icon_set_visible(GTK_STATUS_ICON(icon), TRUE);

	gtk_main();

	return 0;
}
Beispiel #26
0
static void qq_tray_init(QQTray *tray)
{
    gtk_status_icon_set_tooltip_markup(GTK_STATUS_ICON(tray), "<b>GtkQQ</b>");

    QQTrayPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE(tray, qq_tray_get_type()
                                                    , QQTrayPriv);

    priv -> blinking_queue = g_queue_new();
    priv -> tmp_queue = g_queue_new();
    priv -> popupmenu = gtk_menu_new();

    GtkWidget *menuitem;

    menuitem = gtk_check_menu_item_new_with_label("Mute");
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);

    menuitem = gtk_separator_menu_item_new();
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);

    GtkWidget *img;
    GdkPixbuf *pb;
#define STATUS_ITEM(x,y) \
    menuitem = gtk_image_menu_item_new();\
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);\
    pb = gdk_pixbuf_new_from_file_at_size(IMGDIR"/status/"x".png"\
                                                , 12, 12, NULL);\
    img = gtk_image_new_from_pixbuf(pb);\
    g_object_unref(pb);\
    gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), img);\
    gtk_menu_item_set_label(GTK_MENU_ITEM(menuitem), y);\
    g_signal_connect(G_OBJECT(menuitem), "activate"\
                    , G_CALLBACK(qq_tray_status_menu_item_activate), x);

    STATUS_ITEM("online", "Online");
    STATUS_ITEM("hidden", "Hidden");
    STATUS_ITEM("away", "Away");
    STATUS_ITEM("busy", "Busy");
    STATUS_ITEM("callme", "Call Me");
    STATUS_ITEM("silent", "Silent");
#undef STATUS_ITEM

    menuitem = gtk_separator_menu_item_new();
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);

    menuitem = gtk_menu_item_new_with_label("Personal Setting");
    g_signal_connect(G_OBJECT(menuitem), "activate"
                    , G_CALLBACK(qq_tray_personal_setting_menu_item_activate)
                    , NULL);
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);

    menuitem = gtk_menu_item_new_with_label("System Setting");
    g_signal_connect(G_OBJECT(menuitem), "activate"
                    , G_CALLBACK(qq_tray_system_setting_menu_item_activate)
                    , NULL);
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);

    menuitem = gtk_separator_menu_item_new();
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);

    menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL);
    g_signal_connect(G_OBJECT(menuitem), "activate"
                    , G_CALLBACK(qq_tray_about_menu_item_activate)
                    , NULL);
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);
    gtk_menu_item_set_label(GTK_MENU_ITEM(menuitem), "About GtkQQ");

    menuitem = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
    g_signal_connect(G_OBJECT(menuitem), "activate"
                    , G_CALLBACK(qq_tray_quit_menu_item_activate)
                    , NULL);
    gtk_menu_shell_append(GTK_MENU_SHELL(priv -> popupmenu), menuitem);
    gtk_menu_item_set_label(GTK_MENU_ITEM(menuitem), "Quit");

    gtk_widget_show_all(priv -> popupmenu);

    g_signal_connect(G_OBJECT(tray), "popup-menu"
                            , G_CALLBACK(qq_tray_popup_menu), tray);
    g_signal_connect(G_OBJECT(tray), "button-press-event"
                            , G_CALLBACK(qq_tray_button_press), tray);
    g_signal_connect(G_OBJECT(tray), "query-tooltip"
                            , G_CALLBACK(qq_tray_on_show_tooltip), tray);
}
Beispiel #27
0
void tray_on_menu(GtkWidget *widget,guint button,
		guint32 activate_time,gpointer data)
{
	gtk_menu_popup(GTK_MENU(data),NULL,NULL,gtk_status_icon_position_menu,GTK_STATUS_ICON(widget),button,activate_time);
}
Beispiel #28
0
void cgraphics_status_icon_set_visible(status_icon_t * status, int visible)
{
    gtk_status_icon_set_visible(GTK_STATUS_ICON(status), visible? TRUE : FALSE);
}